IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extracting data from a Report


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Thu Mar 03, 2011 5:34 pm
Reply with quote

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
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 03, 2011 11:30 pm
Reply with quote

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.
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Fri Mar 04, 2011 7:39 am
Reply with quote

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'
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Mar 05, 2011 12:24 am
Reply with quote

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)
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top