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

Converting Cobol to SORT


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

New User


Joined: 27 Apr 2009
Posts: 26
Location: addison

PostPosted: Thu Jul 23, 2009 8:30 pm
Reply with quote

Hi all,

This forum is really helpful to me. I have got reply on so many questions. Thanks a lot to to Frank for all his replies.

Now i need one more help. I am trying to convert one cobol program which is running long to SORT so that it will be faster.
Let me tell you how is it now.

MAIN PROGRAM
-------------------
PERFORM till end of DRIVER FILE
a) Read DRIVER FILE KEY
b) Call Sub-program1 to match DRIVER FILE KEY with FILE1 KEY
and write record to OUTPUT-FILE1.
c) Call Sub-program2 to match DRIVER FILE KEY with FILE2 KEY
and write record to OUTPUT-FILE2.
d) Call Sub-program3 to match DRIVER FILE KEY with FILE3 KEY
and write record to OUTPUT-FILE3.
END-PERFORM

Can we achieve this in single SORT if we give
a) DRIVER FILE, FILE1, FILE2, FILE3 as input files and
b) OUTPUT-FILE1, OUTPUT-FILE2, OUTPUT-FILE3 as output files.

Please give your valid suggestions.
Let me know if i need explain my requirement in a better way.

Thanks,
Chandramouli
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jul 23, 2009 9:42 pm
Reply with quote

Hello,

Quote:
Let me know if i need explain my requirement in a better way.
Yes, you need to provide considerably more detail. Post all of the recfms of the files, the lrecls, and describe which positions are used for this process. Sample data of all inputs and the expected output from those inputs should be posted.
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 Jul 23, 2009 9:53 pm
Reply with quote

Chandramouli,

Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If any input file can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
chandramouliravi

New User


Joined: 27 Apr 2009
Posts: 26
Location: addison

PostPosted: Sat Jul 25, 2009 11:58 am
Reply with quote

Hi,

My original files are too big. So i just want to give simple lengths for now to know about approach. I have added some more details to make it more clear.

Driver File --> KEY position: 1:4 Numeric --> FB 4 byte file
FILE1 --> KEY position: 1:4 Numeric, Data position: 5:10 Character
format --> FB 14 byte file
FILE2 --> KEY position: 1:4 Numeric, Data position: 5:20 Character
format --> FB 24 byte file
FILE3 --> KEY position: 1:4 Numeric, Data position: 5:30 Character
format --> FB 34 byte file


OUTPUT-FILE1 --> FB 14 byte file. Should get File1 full record including KEY and data fields, if there is a match between Driver file key and File1 key.

OUTPUT-FILE2 --> FB 24 byte file. Should get File2 full record including KEY and data fields, if there is a match between Driver file key and File2 key.

OUTPUT-FILE3 --> FB 34 byte file. Should get File3 full record including KEY and data fields, if there is a match between Driver file key and File3 key.
Thanks,
Chandramouli
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Jul 27, 2009 9:40 pm
Reply with quote

chandramouli,

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

//STEP0100 EXEC PGM=ICETOOL 
//TOOLMSG  DD SYSOUT=*       
//DFSMSG   DD SYSOUT=*       
//D1       DD DSN=your 04 byte driver file,DISP=SHR
//I1       DD DSN=your 14 byte Input1 file,DISP=SHR
//I2       DD DSN=your 24 byte input2 file,DISP=SHR
//I3       DD DSN=your 34 byte input3 file,DISP=SHR
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)       
//OUT1     DD SYSOUT=*                                             
//OUT2     DD SYSOUT=*                                             
//OUT3     DD SYSOUT=*                                             
//TOOLIN   DD *                                                     
  COPY FROM(D1) USING(CTL1)                                         
  COPY FROM(I1) USING(CTL2)                                         
  COPY FROM(I2) USING(CTL3)                                         
  COPY FROM(I3) USING(CTL4)                                         
  SORT FROM(T1) USING(CTL5)                         
//*               
//CTL1CNTL DD *                                                     
  OUTFIL FNAMES=T1,BUILD=(1,04,35:C'D')                             
//CTL2CNTL DD *                                                     
  OUTFIL FNAMES=T1,BUILD=(1,14,35:C'1')                             
//CTL3CNTL DD *                                                     
  OUTFIL FNAMES=T1,BUILD=(1,24,35:C'2')                             
//CTL4CNTL DD *                                                     
  OUTFIL FNAMES=T1,BUILD=(1,34,35:C'3')                             
//CTL5CNTL DD *                                                     
  SORT FIELDS=(1,4,CH,A),EQUALS                                     
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(37:SEQNUM,8,ZD,RESTART=(1,4))),
  IFTHEN=(WHEN=GROUP,BEGIN=(37,8,ZD,EQ,1),PUSH=(36:35,1))           
  OUTFIL FNAMES=OUT1,INCLUDE=(35,2,CH,EQ,C'1D'),BUILD=(1,14)       
  OUTFIL FNAMES=OUT2,INCLUDE=(35,2,CH,EQ,C'2D'),BUILD=(1,24)       
  OUTFIL FNAMES=OUT3,INCLUDE=(35,2,CH,EQ,C'3D'),BUILD=(1,34)       
//*
Back to top
View user's profile Send private message
chandramouliravi

New User


Joined: 27 Apr 2009
Posts: 26
Location: addison

PostPosted: Sun Aug 02, 2009 11:33 pm
Reply with quote

Hi Kolusu,

Thanks for the logic. Could you please clarify this.

Code:
 IFTHEN=(WHEN=GROUP,BEGIN=(37,8,ZD,EQ,1),PUSH=(36:35,1))

As i understand, WHEN=GROUP starts after WHEN=INIT adds SEQNUM to all records in T1. But i did not understand what does "BEGIN=(37,8,ZD,EQ,1),PUSH=(36:35,1)" perform. How does BEGIN and PUSH work?


I did not understand where is the logic of KEY comparison between
a) D1 and I1
b) D1 and I2
c) D1 and I3.

Could you please clarify.

Thanks,
Chandramouli
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Aug 03, 2009 6:14 am
Reply with quote

Look at the PDF at This link

Frank has given very illustrative examples for the same...
Back to top
View user's profile Send private message
chandramouliravi

New User


Joined: 27 Apr 2009
Posts: 26
Location: addison

PostPosted: Mon Aug 03, 2009 11:37 pm
Reply with quote

Hi Sambhaji,

This link is very helpful. Examples given are very clear.

Thanks to Kolusu and Frank for your help. The SORT step given will work for my requirement.

Thanks,
Chandramouli
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: Tue Aug 04, 2009 12:55 am
Reply with quote

Chandramouli,

Thanks for the feedback.
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
Search our Forums:

Back to Top