|
View previous topic :: View next topic
|
| Author |
Message |
harish_2480
New User
.jpg)
Joined: 07 Jun 2007 Posts: 23 Location: USA
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
harish_2480
New User
.jpg)
Joined: 07 Jun 2007 Posts: 23 Location: USA
|
|
|
|
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 |
|
 |
harish_2480
New User
.jpg)
Joined: 07 Jun 2007 Posts: 23 Location: USA
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
harish_2480
New User
.jpg)
Joined: 07 Jun 2007 Posts: 23 Location: USA
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|