ceasar
New User
Joined: 03 Feb 2006 Posts: 2 Location: Chennai,India
|
|
|
|
Hi
I want to perform the following op/n.
A file contains an amount and a date stored in packed format (E.g. shown below)
20001005
30c1120c
which corresponds to an amount of 23,000 and a date of 11-10-2005
i) First sort the input file based on the date and then convert the data into readable format in the output file.
ii) The amount field should have ?,? and the date should have ?-? as separators.
iii) The two fields should be separated by 5 spaces.
Regards,
Ceasar |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
The DFSORT job below will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN DD *
* Convert P'mmddyyyy' to Z'mmddyyyy' in 81-88
INREC OVERLAY=(81:4,5,PD,EDIT=(TTTTTTTT))
* Sort on Z'yyyy' in 85-88 and Z'mmdd' in 81-84
SORT FIELDS=(85,4,ZD,A,81,4,ZD,A)
* Convert P'nnnnn' to nn,nnn.
OUTREC FIELDS=(1,3,PD,EDIT=(II,IIT),5X,
* Convert P'mmddyyyy' to C'mm-dd-yyyy'
4,5,PD,EDIT=(TT-TT-TTTT))
/*
|
|
|