Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sort & Date conversion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
harish_2480

New User


Joined: 07 Jun 2007
Posts: 23
Location: USA

PostPosted: Fri Jan 07, 2011 1:25 am    Post subject: Sort & Date conversion
Reply with quote

Hi,

I need help for date format conversion, sort to get the missing records in file1.

I need below things.
File A: key will be 1 to 9
File B: key will be 1 to 9

I need to get the records of File A to File C if the File A key is not in File B.

The below is seperate process & another file:
I have another requirement, File D need to be sorted on key 1 to 9, and date need to be converted from yyyy-mm-dd to yyyymmdd. this date field may have yyyy-mm-dd format or spaces also. so 10 bytes to 8 bytes. Please help me for a solution on this.

thank you & regards,
Harish.
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Fri Jan 07, 2011 5:41 am    Post subject: Reply to: Sort & Date conversion
Reply with quote

Harish_2480,

It is difficult to provide solutions without complete details. You haven't provided the DCB and RECFM of the files.

Assuming that your input is FB recfm and LRECL of 80, here is a DFSORT JCL which will give you the missing records from File1

Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//INA      DD *                             
111111111 - MATCH RECORD - DROP             
222222222 - NON MATCH    - WRITE TO OUTPUT   
333333333 - MATCH RECORD - DROP             
//INB      DD *                             
111111111 - MATCH RECORD - DROP             
333333333 - MATCH RECORD - DROP             
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                             
  OPTION COPY                               
  JOINKEYS F1=INA,FIELDS=(1,9,A)             
  JOINKEYS F2=INB,FIELDS=(1,9,A)             
  JOIN UNPAIRED,F1,ONLY                     
//*


The output is
Code:

222222222 - NON MATCH    - WRITE TO OUTPUT   


As for the date conversion it is simple. You just need to remove the separators which can be done using UFF format. If you need to validate the dates then you can use TOGREG function.

Code:

//STEP0200 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                               
111111111  2010-01-01                         
222222222  20090101                           
333333333  2008/01/01                         
444444444                                     
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  OPTION COPY                                 
  INREC OVERLAY=(12:12,10,UFF,M11,LENGTH=8,2X)
//*


The output is
Code:

111111111  20100101
222222222  20090101
333333333  20080101
444444444  00000000
Back to top
View user's profile Send private message
harish_2480

New User


Joined: 07 Jun 2007
Posts: 23
Location: USA

PostPosted: Fri Jan 07, 2011 2:00 pm    Post subject:
Reply with quote

Hi Skolusu,

Sorry for missing the LRECL, RECFM. Thank you very much for the information. i got the main sort card. i managed and got the desired results. excellent and looks like there are so many new features, hmm may be i am not aware and these functions already there. they are very useful. once again thank you very much.

regards,
Harish.
Back to top
View user's profile Send private message
harish_2480

New User


Joined: 07 Jun 2007
Posts: 23
Location: USA

PostPosted: Thu Feb 03, 2011 1:08 am    Post subject: How to get the matching records
Reply with quote

Hi,

what was the sort card or statements to get the common records based on a key from two files to another new file.

LRECL=80,dsorg=PS,RECFM=FB

Example:
input file1:
1111abcd
2222asjd
2222asjd
3333ritu
4444rtyu

input file2:
1111abcd
2222asjd
4444rtyu
4444rtyu
5555lpoi

output should be:
1111abcd
2222asjd
4444rtyu

Please help me on this. is there anything like joinkeys, paired?

i tried different ways. i searched and it's pointing to splice. Is there anything i can do by using ICETOOL SELECT?

thanks in advance,
thank you & regards,
Harish.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Feb 03, 2011 1:52 am    Post subject:
Reply with quote

harish_2480,

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//INA      DD *                                   
1111ABCD                                         
2222ASJD                                         
2222ASJD                                         
3333RITU                                         
4444RTYU                                         
//INB      DD *                                   
----+----1----+----2----+----3----+----4----+----5
1111ABCD                                         
2222ASJD                                         
4444RTYU                                         
4444RTYU                                         
5555LPOI                                         
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                   
  OPTION COPY                                     
  JOINKEYS F1=INA,FIELDS=(1,8,A)                 
  JOINKEYS F2=INB,FIELDS=(1,8,A)                 
  REFORMAT FIELDS=(F1:1,80)                       
//JNF1CNTL DD *                                   
  SUM FIELDS=NONE                                 
//JNF2CNTL DD *                                   
  SUM FIELDS=NONE                                 
/* 
Back to top
View user's profile Send private message
harish_2480

New User


Joined: 07 Jun 2007
Posts: 23
Location: USA

PostPosted: Thu Feb 03, 2011 2:28 am    Post subject:
Reply with quote

Hi Skolusu,

thank you very much for your timely help and excellent solution. it look very easy with these steps. It's working fine. i got my desired results.

once again thank you very much for your support and help.
regards,
Harish.
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 Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us