|
View previous topic :: View next topic
|
| Author |
Message |
Vinodc
New User

Joined: 01 Dec 2005 Posts: 33 Location: Prague
|
|
|
|
Hi,
DavidatK advised me that I can get faster help in this forum, so here I am.
My requirement is to correct data in a VSAM KSDS file. Its key is:
05 XXX_Account Number PIC 9(19) Comp-3.
05 XXX_Date PIC 9(8) Comp-3.
05 XXX_Time PIC 9(7) Comp-3.
XX_Time(2:2) contains Hours, XX_Time (4:2) contains minutes, XX_Time(6:2) contains seconds.
Some of the records in file contains incorrect value for XX_Time. ie, XX_Time(2:2) > 23 or XX_Time >59 or XX_Time(6:2) > 59. So need is to correct the time such that if XX_Time(2:2) > 23, make XX_Time(2:2) = 23, XX_Time > 59 make XX_Time = 59 or XX_Time(6:2) > 59 then make XX_Time(6:2) = 59.
The file contains tens of thousands of records, and quite a few of them have incorrect time value.
So the logic should be:
Read record from input file sequentially,
if time is correct, write same record in output file of same format.
if time is incorrect, correct time and write the record in output.
Thanks in advance. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
In DFSORT terms, your fields are as follows:
05 XXX_Account Number PIC 9(19) Comp-3 -> 10-byte PD field
05 XXX_Date PIC 9(8) Comp-3 -> 5-byte PD field
05 XXX_Time PIC 9(7) Comp-3 -> 4-byte PD field
So your time field starts at position 16 and looks like this: X'0hhmmssC'.
You can use a DFSORT/ICETOOL job like the one below to do what you asked for. I assumed your VSAM records are 19-byte fixed-length records as described. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
Use [URL] BBCode for External Links
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... VSAM input file
//SORTOUT DD DSN=... VSAM output file
//SYSIN DD *
OPTION COPY
RECORD TYPE=F
INREC IFTHEN=(WHEN=INIT,OVERLAY=(20:16,4,PD,TO=ZD,LENGTH=6)),
IFTHEN=(WHEN=(20,2,ZD,GT,+23),OVERLAY=(20:C'23'),HIT=NEXT),
IFTHEN=(WHEN=(22,2,ZD,GT,+59),OVERLAY=(22:C'59'),HIT=NEXT),
IFTHEN=(WHEN=(24,2,ZD,GT,+59),OVERLAY=(24:C'59'))
OUTREC BUILD=(1,15,16:20,6,ZD,TO=PD,LENGTH=4)
/*
|
|
|
| Back to top |
|
 |
Vinodc
New User

Joined: 01 Dec 2005 Posts: 33 Location: Prague
|
|
|
|
Thanks Frank. My Mainframe has the version of DFSORT you mentioned. But my requirements were not clearly understood by you, Sorry, I havent been that clear. I also tried to understand and change the SYSIN as per my requirement, but wasunsuccessful. Please help again.
The File is VSAM KSDS with record length 425. The key is
| Code: |
01 FILE11-RECORD.
03 FILE11-KEY.
05 FILE11-ORG PIC 9(03).
05 FILE11-ACCOUNT PIC X(19).
05 FILE11-HIST-DATE PIC S9(07) COMP-3.
05 FILE11-HIST-TIME PIC S9(07) COMP-3.
05 FILE11-RECORD-TYPE PIC X(01).
|
FILE11-HIST-TIME(2:2) contains Hours, FILE11-HIST-TIME(4:2) contains minutes, FILE11-HIST-TIME(6:2) contains seconds.
Some of the records in file contains incorrect value for FILE11-HIST-TIME. ie, FILE11-HIST-TIME(2:2) > 23 or FILE11-HIST-TIME >59 or FILE11-HIST-TIME (6:2) > 59. So need is to correct the time such that if FILE11-HIST-TIME(2:2) > 23, make FILE11-HIST-TIME(2:2) = 23, FILE11-HIST-TIME > 59 make FILE11-HIST-TIME = 59 or FILE11-HIST-TIME(6:2) > 59 then make FILE11-HIST-TIME(6:2) = 59.
The file contains tens of thousands of records, and quite a few of them have incorrect time value.
So the logic should be:
Read record from input file sequentially,
if time is correct, write same record in output file of same format.
if time is incorrect, correct time and write the record in output.
Thanks in advance.
Vinod |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Vinod,
The job I gave you does what you described in your first post. The only difference I see between what you described the first time and the second time is that you've changed the record layout. The Time field in your new layout starts at position 27 whereas it started in position 16 in the old layout and you've now said that the records are 425 bytes long. Given that, the following variation of my DFSORT job would do what you asked for:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... VSAM input file
//SORTOUT DD DSN=... VSAM output file
//SYSIN DD *
OPTION COPY
RECORD TYPE=F
INREC IFTHEN=(WHEN=INIT,OVERLAY=(426:27,4,PD,TO=ZD,LENGTH=6)),
IFTHEN=(WHEN=(426,2,ZD,GT,+23),OVERLAY=(426:C'23'),HIT=NEXT),
IFTHEN=(WHEN=(428,2,ZD,GT,+59),OVERLAY=(428:C'59'),HIT=NEXT),
IFTHEN=(WHEN=(430,2,ZD,GT,+59),OVERLAY=(430:C'59'))
OUTREC BUILD=(1,26,27:426,6,ZD,TO=PD,LENGTH=4,31,395)
/*
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|