Page 1 of 1

Date field update

PostPosted: Wed Apr 14, 2010 3:10 pm
by Naveen@Uppi
Hi All,

In my output file, one of the date field has the format YYYYMMDD.

Few records have got the date field filled with 2000 or1993. Few records have data in the right format.
And i want to update the date to YYYYMMDD (any default value)

Please suggest the best way to do this?

Regards,
Naveen N

Re: Date field update

PostPosted: Wed Apr 14, 2010 8:11 pm
by Alissa Margulies
Please show sample records with the correct and incorrect date fields, along with your desired output.

Re: Date field update

PostPosted: Wed Apr 14, 2010 8:56 pm
by Naveen@Uppi
In the current file the date format is 1993 (YYYYMMDD, so the date appearing now is SSSS1993). S- spaces.

I want to check the date format and update it to 20100320.

And picture clause of the date is Packed decimal.

Regards,
Naveen N

Re: Date field update

PostPosted: Wed Apr 14, 2010 11:43 pm
by dick scherrer
Hello,

Now that you have been a member for almost 2 years, why have you not provided proper information for someone to use to help?

What are the dsorg and lrecl of both files? What are the relevant data positions?

How can a "Packed decimal" field contain spaces? (It can't). . . Suggest you show a few of the input records in hex. . .

Re: Date field update

PostPosted: Thu Apr 15, 2010 7:17 pm
by Naveen@Uppi
Hi,

I was not involved in Mainframes testing for some time now.

The date fied has been declared has PIC S9(09) PACKED-DECIMAL.The length of the field in FAM view is 5.

Regards,
Naveen N

Re: Date field update

PostPosted: Thu Apr 15, 2010 7:50 pm
by Alissa Margulies
As we have previously requested, just to be sure we understand how your data is formatted in the record, please provide some sample records including the date fields (with and without blanks) with HEX turned on. Thank you.

Re: Date field update

PostPosted: Thu Apr 15, 2010 9:53 pm
by Naveen@Uppi
HI

The In correct date in Hex format:
00093
0019C

I want the date to be updated to:
00660
2003C

Regards,
Naveen N

Re: Date field update

PostPosted: Thu Apr 15, 2010 10:35 pm
by Alissa Margulies
Assuming the date field is the first 5 bytes of the record, try this:
//SORT1 EXEC PGM=SORT                           
//SORTIN  DD DSN=INPUT.FILE                     
//SORTOUT DD DSN=OUTPUT.FILE                     
//SYSOUT  DD SYSOUT=*                           
//SYSIN   DD *                                   
   SORT FIELDS=COPY                             
   OUTREC IFTHEN=(WHEN=(1,5,BI,EQ,X'000001993C'),
          OVERLAY=(1:X'020060630C'))             
//***********************************************

Re: Date field update

PostPosted: Thu Apr 15, 2010 11:57 pm
by Naveen@Uppi
Thanks you very much, it works