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
 

 

Converting Cobol to SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Converting Cobol to SORT
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

Site Director


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

PostPosted: Thu Jul 23, 2009 9:42 pm    Post subject:
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 Moderator


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

PostPosted: Thu Jul 23, 2009 9:53 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Converting Cobol to SORT
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    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Aug 04, 2009 12:55 am    Post subject:
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    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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm


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