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

Extract Selective Records from COBOL Report


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

New User


Joined: 12 Dec 2007
Posts: 3
Location: Torrance

PostPosted: Wed Jun 25, 2008 2:30 pm
Reply with quote

Hi,
I have an COBOL report with LRECL 133 in the following format.

The Headers can be identified with the word "ACCOUNT" starting at position 1.
The report-ID starts at position 9 and is of 7 bytes.

The Trailer can be identified as a sequence of 133 dashes('---------------')

ACCOUNT 1111111
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
ACCOUNT 2222222
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
ACCOUNT 1111111
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
ACCOUNT 4444444
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------

The report IDs are not sorted in Arranging order and a report-ID can repeat at any place in the report any number of times.

In my example above, the Report-ID '1111111' is repeated twice at different positions.

I want to extract all header, Detail and Trailer records for a required Report-ID
For example, I want to extract the records for Report-ID 1111111

ACCOUNT 1111111
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------
ACCOUNT 1111111
Detail Record-1.....
Detail Record-2.....
Detail Record-3.....
.
.
Detail Record-N.....
-------------------------

Is there any way to do it using ICETOOL.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 25, 2008 9:28 pm
Reply with quote

Kingshuk Roy,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*     
//DFSMSG   DD SYSOUT=*     
//IN       DD DSN=your input file,
//            DISP=SHR
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  SPLICE FROM(IN) TO(OUT) ON(134,8,CH) KEEPNODUPS WITHALL - 
  WITH(1,133) KEEPBASE USING(CTL1)                           
//CTL1CNTL DD *                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),       
  IFTHEN=(WHEN=(1,7,CH,EQ,C'ACCOUNT'),                       
  OVERLAY=(134:SEQNUM,8,ZD,9,7)),                           
  IFTHEN=(WHEN=NONE,OVERLAY=(142:SEQNUM,8,ZD,               
           134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))         
                                                             
  SORT FIELDS=COPY                                           
  OUTFIL FNAMES=OUT,BUILD=(1,133),                           
  INCLUDE=(142,7,CH,EQ,C'1111111')                           
/*


Hope this helps...

Cheers
Back to top
View user's profile Send private message
Kingshuk Roy

New User


Joined: 12 Dec 2007
Posts: 3
Location: Torrance

PostPosted: Thu Jun 26, 2008 11:31 am
Reply with quote

Hi Skolusu
This is not working. I am getting an Error.

I am putting down the error message here.

END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=IN,SOR*
TOUT=OUT,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,NOCH*
ECK
SORT FIELDS=(134,8,CH,A)
MODS E35=(ICE35DU,12288)
RECORD TYPE IS F - DATA STARTS IN POSITION 1
END OF FIELD BEYOND MAXIMUM RECORD LENGTH
END OF DFSORT


Look at the BOLD portion above. I think that I need to move the output into an temp variable first and then into the OUT dataset.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 26, 2008 10:47 pm
Reply with quote

Kingshuk Roy,

I need to see your complete DFSMSG messages. However I am guessing that you don't have the latest PTF which supports INREC processing with SPLICE. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006). If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free).

One way to verify that you have the PTF is

Look at the ICE201I message in DFSMSG . If you see a zero then your version does not support INREC processing with splice.

Quote:

ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1


If you have the latest PTF then the message would have an E

Quote:

ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1


if you don't have the latest PTF then use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*     
//DFSMSG   DD SYSOUT=*     
//IN       DD DSN=your input file,
//            DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                           
  COPY FROM(IN) USING(CTL1)                               
  SPLICE FROM(T1) TO(OUT) ON(134,8,CH) KEEPNODUPS WITHALL -
  WITH(1,133) KEEPBASE USING(CTL2)                         
//CTL1CNTL DD *                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,8,ZD)),     
  IFTHEN=(WHEN=(1,7,CH,EQ,C'ACCOUNT'),                     
  OVERLAY=(134:SEQNUM,8,ZD,9,7)),                         
  IFTHEN=(WHEN=NONE,OVERLAY=(142:SEQNUM,8,ZD,             
           134:134,8,ZD,SUB,142,8,ZD,M11,LENGTH=8))       
  OUTFIL FNAMES=T1                                         
//CTL2CNTL DD *                                           
  SORT FIELDS=COPY                                         
  OUTFIL FNAMES=OUT,BUILD=(1,133),                         
  INCLUDE=(142,7,CH,EQ,C'1111111')                         
/*                                                         


Hope this helps....

Cheers
Back to top
View user's profile Send private message
Kingshuk Roy

New User


Joined: 12 Dec 2007
Posts: 3
Location: Torrance

PostPosted: Mon Jun 30, 2008 4:59 pm
Reply with quote

Hi Skolusu,

Thanks a lot. Your Solution is working perfectly.
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 Sep 18, 2008 2:45 am
Reply with quote

You can do this kind of thing more easily and efficiently with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:

Code:

//S1    EXEC  PGM=ICEMAN
//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,7,CH,EQ,C'ACCOUNT'),
    PUSH=(134:9,7))
  OUTFIL INCLUDE=(134,7,CH,EQ,C'1111111'),BUILD=(1,133)
/*


For complete details on the WHEN=GROUP function and the other new functions available with PTF UK90013, see:

Use [URL] BBCode for External Links
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 Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top