suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
Hi
I have a report which is Fixed block and having the record length of 133. I want to pickup 15 characters wherever in the report 'AGENCY NAME :' appeared. The position is not fixed. Also, the next entire row where the 'ITEM NAME' is appearing. In the output, the data should come in a single line. The Example given below
Input
Code: |
AGENCY NAME : ABC CORP.
ITEM NAME
DB2 Z/OS Guide
AGENCY NAME : ABC CORP.
ITEM NAME
COBOL refresher |
The output I need as below.
Output
Code: |
ABC CORP. DB2 Z/OS Guide
ABC CORP. COBOL refresher |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Your description of the requirement vs your example is rather confusing.
Are the lines you show the only lines in the report or are there other lines in the report that you need to ignore?
Quote: |
the next entire row where the 'ITEM NAME' is appearing. |
Huh? Are ITEM NAME and DB2 Z/OS Guide in two different records as shown, or in one record as implied by "the next entire row ...".
Quote: |
I want to pickup 15 characters wherever in the report 'AGENCY NAME :' appeared. The position is not fixed. |
It looks fixed in your example.
Please show a better example of your input records that clears up all this confusion about what it looks like. |
|
suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
Sorry for the confusion.
Code: |
ADDRESS : AGENCY NAME : ABC CORP.
ITEM NAME
DB2 Z/OS Guide
The order shipped on dated. 11/01/2010
ADDRESS : BENTICK STREET AGENCY NAME : XYZ CORP.
NY ITEM NAME
COBOL refresher
Shipment received on dated 11/01/2010 |
The output I need as below.
Code: |
ABC CORP. DB2 Z/OS Guide
XYZ CORP. COBOL refresher |
Quote: |
Are the lines you show the only lines in the report or are there other lines in the report that you need to ignore? |
There are other lines in the report which I want to ignore.
Quote: |
Are ITEM NAME and DB2 Z/OS Guide in two different records as shown, or in one record as implied by "the next entire row ...".
|
ITEM NAME and DB2 Z/OS Guide are two different records. What i need is, in my output I want to pick up 'DB2 Z/OS Guide'. And 'DB2 Z/OS Guide' will appear after 'ITEM NAME' |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT job like the following to do what you asked for.
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/133)
//SORTOUT DD DSN=... output file (FB/133)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,120,SS,EQ,C'AGENCY NAME :'),
RECORDS=3,PUSH=(134:SEQ=1)),
IFTHEN=(WHEN=(134,1,ZD,EQ,1),
PARSE=(%01=(STARTAFT=C'AGENCY NAME : ',FIXLEN=15)),
BUILD=(%01,134:134,1)),
IFTHEN=(WHEN=(134,1,ZD,EQ,3),
PARSE=(%02=(STARTAT=NONBLANK,FIXLEN=20)),
BUILD=(17:%02,134:134,1))
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(134,1,ZD,EQ,1),
RECORDS=3,PUSH=(1:1,15))
OUTFIL INCLUDE=(134,1,ZD,EQ,3),BUILD=(1,133)
/*
|
|
|