Page 1 of 1

SORT help needed for date manipulation.

Posted: Wed Sep 14, 2016 2:36 pm
by passion56
Hello,

I need help in manipulating a date present in the header. For a file I have the header is in the form:

Code: Select all

ZHEDRFGG6500 YYYYMMDD 

Code: Select all

RECORD-ID(1)-HEADERID(2-5)-Dataset ID(6-12)-YYYYMMDD(13-20)
Pos-13 to 20-Date= `YYYYMMDD' which i'm intrested in.

I want to reformat only the date from YYYYMMDD to DDMMYYYY in a single sort card, without changing the existing detail and footer records. Can you please help me out to do this. I failed to get it working with OVERLAY,OUTREC and INREC combinations.
But it did not work.

Re: SORT help needed for date manipulation.

Posted: Wed Sep 14, 2016 3:49 pm
by nicc
a file I have
Nope, you do not have a file. You have a data set.
And what do you mean by "did not work"? That phrase has several interpretations.

Re: SORT help needed for date manipulation.

Posted: Wed Sep 14, 2016 6:47 pm
by Magesh_j
Screen shot show date starts from 14th position, but you gave screen shot Date(13-20).

Code: Select all

 =COLS> ----+----1----+----2--
 000006 ZHEDRFGG6500 YYYYMMDD 
 
if the date starts @ 14th column, use below code. Assuming LRECL=80

Code: Select all

INREC IFTHEN=(WHEN=(2,4,CH,EQ,C'HEDR'),    
              OVERLAY=(81:20,2,18,2,14,4,  
                       14:81,08)),         
      IFOUTLEN=80                          
                                           
OPTION COPY                                
Thanks
Magesh