Jump to content

Hello everybody! I am trying to get a structure for a data f...


Ricky Ray 2

Recommended Posts

Hello everybody!

I am trying to get a structure for a data feed that has a BY clause over the records, then has a define file seperating it from the next break. So for example in the CAR file, I want the country to act like a column heading, the models to act like the records, then a footing that seperates the records from the next country.

So that needs to look something like this example using the CAR file:

ENGLAND

V12XKE AUTO

XJ12L AUTO

INTERCEPTOR III

TR7

----------

JAPAN

B210 2 DOOR AUTO

COROLLA 4 DOOR DIX AUTO

----------

etc.

Using this code I get close:

DEFINE FILE CAR

INFO/A50 = CAR| '|MODEL;

RECORDBREAK/A10 = ----------;

END

TABLE FILE CAR

PRINT

COUNTRY AS OVER

MODEL AS OVER

RECORDBREAK AS

END

But COUNTRY and RECORDBREAK repeat for each instance of MODEL.

 

Any guidance on how I could accomplish this would be appreciated!

I am on App Studio 8105m.

Link to comment
Share on other sites

I wouldnt use OVER, Id use SUBHEAD.

 

TABLE FILE ibisamp/car

BY CAR.ORIGIN.COUNTRY NOPRINT

ON CAR.ORIGIN.COUNTRY SUBHEAD

<CAR.ORIGIN.COUNTRY

BY CAR.CARREC.MODEL

ON TABLE PCHOLD FORMAT HTML

ON TABLE NOTOTAL

ON TABLE SET CACHELINES 100

ON TABLE SET GRWIDTH 1

ON TABLE SET STYLE *

INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$

ENDSTYLE

END

-RUN

Link to comment
Share on other sites

I am getting an error with that code. It is having an issue recognizing the < call

WebFOCUS Message[42]: NO EDA HTML Output

0 ERROR AT OR NEAR LINE 4 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC018) THE OPTION IN THE ON PHRASE IS INVALID: <CAR.ORIGIN.COUNTRY BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT

Link to comment
Share on other sites

The SUBHEAD requires double quotes on the beginning and end. I think this site, changes the two double quotes into up/down quotes like Microsoft Word to make it look pretty. Just delete the quotes around the SUBHEAD and type double quotes from your keyboard.

 

image.png900643 14.1 KB

Link to comment
Share on other sites

Okay this method works great for an excel spreadsheet. How do I preserve this formatting for a text file Using FORMAT ALPHA I lose the perfect formatting.

TABLE FILE ibisamp/car

BY CAR.ORIGIN.COUNTRY NOPRINT

ON CAR.ORIGIN.COUNTRY SUBHEAD

"<CAR.ORIGIN.COUNTRY"

 

BY CAR.CARREC.MODEL

ON TABLE PCHOLD FORMAT ALPHA

ON TABLE NOTOTAL

ON TABLE SET CACHELINES 100

ON TABLE SET GRWIDTH 1

END

 

-RUN

 

-EXIT

Link to comment
Share on other sites

Fantastic! The one last hurdle is how do I suppress the page number from showing up

In the documentation Reporting Language > Creating Reports With WebFOCUS Language > Choosing a Display Format>Using Word Processing Display Formats: DOC, WP it says:

If you issue the SET PAGE = OFF command, or include TABPAGENO in a heading or footing, WP will indicate page breaks by including the character 1 in the first column at each break, which is recognized as a page break control in the S/390 environment. WP format does not include page breaks that are recognized by most browsers or word processing programs.

I dont want any kind of page numbering, so SET PAGE = OFF isnt enough. Thank you for all of your help on this!

Link to comment
Share on other sites

  • 2 weeks later...

You can get one blank space with spot markers. If that isnt enough then you can reprocess the output. For example:

FILEDEF data DISK data.txt

FILEDEF master DISK data.mas

 

TABLE FILE ibisamp/car

BY CAR.ORIGIN.COUNTRY NOPRINT

BY CAR.CARREC.MODEL AS ''

HEADING

" "

WHEN 1=0

ON CAR.ORIGIN.COUNTRY SUBHEAD

"----------"

"<CAR.ORIGIN.COUNTRY"

ON TABLE SET PAGE NOPAGE

ON TABLE HOLD AS data FORMAT WP

END

-RUN

 

-WRITE master FILENAME=data, SUFFIX=FIX, IOTYPE=STREAM, DATASET=data.txt,$

-WRITE master SEGMENT=data, SEGTYPE=S0, $

-WRITE master FIELDNAME=Blank, ALIAS=E01, USAGE=A02, ACTUAL=A02, $

-WRITE master FIELDNAME=Value, ALIAS=E02, USAGE=A23, ACTUAL=A23, $

 

TABLE FILE data

PRINT Value

ON TABLE SET PAGE NOLEAD

ON TABLE HOLD FORMAT ALPHA DELIMITER '' ENCLOSURE '' DATASET baseapp/datafeed.txt

END

 

Places a datafeed.txt file in baseapp. The HEADING WHEN 1=0 gets rid of the extra blank line at the beginning of the file.

Link to comment
Share on other sites

Thank you David that was perfect. I will mark the issue as solved. I do have one question regarding this. When you are referencing DISK in the FILEDEF, where is that exactly

We have a unique system where our WebFOCUS reporting server and MR are physically located in a different location and we use networking stuff to sort of remote access it. Because of this I never have really gotten to know how FILEDEF files actually work when you are not writing to an app path. I know that if I FILEDEF and generate a file in an application path, I can see the file if I go to the reporting portal and look in the application path directory (like putting something in baseapp). However, when you are writing something to DISK, where is that actually going

Link to comment
Share on other sites

  • 2 weeks later...
This neverending project continues. The issue we are facing now is the need to remove the spacing at the end of each row. In your Davids example for the Value field, the length is 23 characters. Is there a way to remove the trailing spacing for when the Value field is less than 23 characters long
Link to comment
Share on other sites

Thank you David! I did not have the DATASET portion of the code on there.

I had a FILEDEF function above it defining where I wanted to the HOLD data to go to. I just changed the DATASET from baseapp/datafeed.txt to where I had the FILEDEF pointed to and it totally works. Thank you again for all of your help on this project!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...