Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extract Selective Records from COBOL Report

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Extract Selective Records from COBOL Report
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Sep 18, 2008 2:45 am    Post subject:
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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts Splitting of single report to seperat... abdulrafi TSO/ISPF 4 Mon Mar 27, 2017 3:59 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us