|
|
| Author |
Message |
guptah
New User
Joined: 08 Apr 2008 Posts: 5 Location: Gurgaon
|
|
|
|
My requirement is:
I have two files
File 1 - It has four fields with lengths of 6,8,3,1 byte respectively
A1 A2 A3 A4
00000100000001001R
File 2 (similar to File 1)
Merge these two files and create a new file with Header & Trailer Record in it.
Merging these 2 records is easy but i don't know how can i put header & trailer into the file as the input file doesn't contain any header.
Header record will have:
Low Values in first 14 bytes.
Some hard coded value in next 10 bytes
Another hard coded value in next 1 byte
Date of 8 bytes (numeric). This field should come from a file which stores date in first 8 bytes in PD format.
Trailer record will have:
High values in first 14 bytes.
Some hard coded value in next 10 bytes
Another hard coded value in next 1 byte
Record count in next 10 bytes.
ICETOOL can be used to put Header and trailer but i am not too sure how to use it.
Can anybody help me in this?
Regards,
M |
|
| Back to top |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
| Quote: |
| Date of 8 bytes (numeric). This field should come from a file which stores date in first 8 bytes in PD format. |
You can use that record to create a symbol for TDATE as follows:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... file with date
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'TDATE,''',1,8,C'''',80:X)
/*
|
Then you can use this Symbol in your merge step for the date by including this DD statement:
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
You can use DFSORT's OUTFIL statement with HEADER1 for the header and TRAILER1 for the trailer. For example:
| Code: |
OUTFIL HEADER1=(14X'00',C'cccccccccc'c',TDATE),
TRAILER1=(14X'00',C'cccccccccc',C'c',COUNT=(M11,LENGTH=10))
|
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html |
|
| Back to top |
|
 |
guptah
New User
Joined: 08 Apr 2008 Posts: 5 Location: Gurgaon
|
|
|
|
Hi Frank,
Thanks for your answer.
So the complete solution i can say will look somethng like:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... file with date
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'TDATE,''',1,8,C'''',80:X)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
/SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=....file 1
// DD DSN=.....file2
//SORTOUT DD DSN=Output file,UNIT=SYSDA,SPCE=(CYL(1,1)),DISP=(NEW,CATLG,DELETE),LERECL=40 etc.
//SYSIN DD *
SORT FIELDS = (1,6,CH,A,7,8,CH,A,15,3,CH,A) - To sort o/p file on Key
OUTFIL HEADER1=(14X'00',C'cccccccccc',C'c',TDATE),
TRAILER1=(14X'00',C'cccccccccc',C'c',COUNT=(M11,LENGTH=10))
/*
|
Please correct me if i am wrong. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
Well, you're close but you have some errors. The job would be:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... file with date
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'TDATE,''',1,8,C'''',80:X)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=....file1
// DD DSN=....file2
//SORTOUT DD DSN=outputfile,UNIT=SYSDA,SPACE=(CYL,(1,1)),
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=(1,6,CH,A,7,8,CH,A,15,3,CH,A)
OUTFIL HEADER1=(14X'00',C'cccccccccc',C'c',TDATE),
TRAILER1=(14X'00',C'cccccccccc',C'c',COUNT=(M11,LENGTH=10))
/*
|
|
|
| Back to top |
|
 |
guptah
New User
Joined: 08 Apr 2008 Posts: 5 Location: Gurgaon
|
|
|
|
Hi Frank,
I did run the Job,its running fine with few exceptions.
the Date on the Header is still coming in PD format but i want it in NUmeric displayable format. I am doing anything wrong here?
Here is the header record i am getting:
| Code: |
1 GCCEDTRIGRR Ø <
F00000000000000CCCCCEDCCDD00834444444444
100000000000000733543997992001C000000000 |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4579 Location: San Jose, CA
|
|
|
|
| Quote: |
| the Date on the Header is still coming in PD format but i want it in NUmeric displayable format. |
I took the following statement in your first post to mean you wanted it in PD format
| Quote: |
| Date of 8 bytes (numeric). This field should come from a file which stores date in first 8 bytes in PD format. |
PD is "numeric". Do you mean you want it in ZD format? If so, then just change the INREC statement to:
| Code: |
INREC BUILD=(C'TDATE,''',1,8,PD,TO=ZD,LENGTH=n,C'''',80:X)
|
where n is the length you want for the ZD date field. |
|
| Back to top |
|
 |
|
|
|