Page 1 of 1

Date Conversion in SORT

PostPosted: Wed May 01, 2019 3:47 pm
by golemis
Hi,
I am struggling with a date conversion in SORT. I have to get a date from a file where first two chars is C'01' and the next five the Julian Date. And output a record of length 80 with
NARRATIVE11ddmmyyyy

I am using:

 SORT FIELDS=COPY
   INCLUDE FORMAT=CH,COND=(2,2,CH,EQ,C'01')
   OUTFIL BUILD=(C'NARRATIVE11',10,5,Y2T,DT=(DM4),81X)
   SUM FIELDS=NONE


But always get ABENDU0007 with SYNTAX ERROR At:
OUTFIL BUILD=(C'NARRATIVE11',10,5,Y2T,DT=(DM4),81X)
                                              £


Any hints ? Thank you, GG

Re: Date Conversion in SORT

PostPosted: Wed May 01, 2019 5:24 pm
by golemis
golemis wrote:Hi,
I am struggling with a date conversion in SORT. I have to get a date from a file where first two chars is C'01' and the next five the Julian Date. And output a record of length 80 with
NARRATIVE11ddmmyyyy

I am using:

 SORT FIELDS=COPY
   INCLUDE FORMAT=CH,COND=(2,2,CH,EQ,C'01')
   OUTFIL BUILD=(C'NARRATIVE11',10,5,Y2T,DT=(DM4),81X)
   SUM FIELDS=NONE


But always get ABENDU0007 with SYNTAX ERROR At:
OUTFIL BUILD=(C'NARRATIVE11',10,5,Y2T,DT=(DM4),81X)
                                              £


Any hints ? Thank you, GG


Replacing the OUTFIL statement with :
  OUTFIL BUILD=(10,5,Y2T)

I managed to get 2019121 (yyddd)! Question now is how I convert it to ddmmyyyy

Re: Date Conversion in SORT

PostPosted: Wed May 01, 2019 5:35 pm
by golemis
golemis wrote:Hi,
I am struggling with a date conversion in SORT. I have to get a date from a file where first two chars is C'01' and the next five the Julian Date. And output a record of length 80 with
NARRATIVE11ddmmyyyy

I am using:

 SORT FIELDS=COPY
   INCLUDE FORMAT=CH,COND=(2,2,CH,EQ,C'01')
   OUTFIL BUILD=(C'NARRATIVE11',10,5,Y2T,DT=(DM4),81X)
   SUM FIELDS=NONE


But always get ABENDU0007 with SYNTAX ERROR At:
OUTFIL BUILD=(C'NARRATIVE11',10,5,Y2T,DT=(DM4),81X)
                                              £


Got it !
OUTFIL BUILD=(10,5,Y2T,DTNS=(DM4))


Any hints ? Thank you, GG

Re: Date Conversion in SORT

PostPosted: Wed May 01, 2019 6:21 pm
by expat
My first question would be .............

If the LRECL is 80, does not 81X fill up to cc81 ???

Re: Date Conversion in SORT

PostPosted: Wed May 01, 2019 9:05 pm
by golemis
expat wrote:My first question would be .............

If the LRECL is 80, does not 81X fill up to cc81 ???


Thanks for the hint, found it out the hard way and corrected it.

Re: Date Conversion in SORT

PostPosted: Wed May 01, 2019 9:07 pm
by golemis
So:
OUTFIL BUILD=(C'NARRATIVE11',10,5,Y2T,DTNS=(DM4),61X)

solves my issue. Thank you all for your attention