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
 
Data Correction in key of KSDS File

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

New User


Joined: 01 Dec 2005
Posts: 33
Location: Prague

PostPosted: Wed Mar 01, 2006 5:00 am    Post subject: Data Correction in key of KSDS File
Reply with quote

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
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Mar 01, 2006 6:51 am    Post subject:
Reply with quote

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:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/


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
View user's profile Send private message
Vinodc

New User


Joined: 01 Dec 2005
Posts: 33
Location: Prague

PostPosted: Thu Mar 09, 2006 7:39 pm    Post subject: Data Correction in key of KSDS File
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Mar 09, 2006 9:53 pm    Post subject:
Reply with quote

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
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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