IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Replace this YYYYMMDD with the current date


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Mar 21, 2006 2:50 am
Reply with quote

I have FB file with record length 80.I have a string YYYYMMDD in different positions in the file. I have to replace this YYYYMMDD with the current date.I guess we have a function called DATE1 for this..but I'm not sure as to how I should be using this. Can someone help me out please!!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Mar 21, 2006 3:53 am
Reply with quote

DATE1 generates a constant of C'yyyymmdd' for the current date.

If you want to put the current date in fixed positions in the records (e.g. 11-18, 40-57, etc), you can use DFSORT statements like this:

Code:

   OPTION COPY
   INREC OVERLAY=(11:DATE1,40:DATE1,...)


If you need to find the string C'YYYYMMDD' anywhere in the records and replace it, sort products don't have any simple built-in functions for that. However, you could do it with 73 IFTHEN clauses like this:

Code:

   OPTION COPY
   INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'YYYYMMDD'),
           OVERLAY=(1:DATE1),HIT=NEXT),
         IFTHEN=(WHEN=(2,8,CH,EQ,C'YYYYMMDD'),
           OVERLAY=(2:DATE1),HIT=NEXT),
         IFTHEN=(WHEN=(3,8,CH,EQ,C'YYYYMMDD'),
           OVERLAY=(3:DATE1),HIT=NEXT),
         ...
         IFTHEN=(WHEN=(72,8,CH,EQ,C'YYYYMMDD'),
           OVERLAY=(72:DATE1),HIT=NEXT),
         IFTHEN=(WHEN=(73,8,CH,EQ,C'YYYYMMDD'),
           OVERLAY=(73:DATE1))
Back to top
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Mar 21, 2006 6:31 am
Reply with quote

Thanks for the reply frank.
But am getting an error and the sysout reads

"
Code:

   OPTION COPY                                   
   INREC OVERLAY=(35:DATE1)                       
         *                                       
  INREC STATEMENT   : SYNTAX ERROR         
  SYNCSMF  CALLED BY SYNCSORT; RC=0000     
  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE     "
Back to top
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Mar 21, 2006 6:33 am
Reply with quote

Code:

//SYSIN     DD *               
   OPTION COPY                 
   INREC OVERLAY=(35:DATE1)     


assuming YYYYMMDD is always in position 35

My apologies for missing this in my previous post

Thanks!!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Mar 21, 2006 6:37 am
Reply with quote

That INREC statement works fine with DFSORT, but the WER messages indicate you're using Syncsort, not DFSORT. With Syncsort, you'll need to use FIELDS and specify the positions before and after the one you want to overlay (that would, of course, work with DFSORT too).
Back to top
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Mar 21, 2006 7:20 am
Reply with quote

Where exactly in the job should I specify that the job needs to use DFSORT?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Mar 21, 2006 9:06 pm
Reply with quote

Quote:
Where exactly in the job should I specify that the job needs to use DFSORT?


You can only use DFSORT if your shop has a license for DFSORT. Given that your primary sort is Syncsort, your shop probably only has a license for Syncsort and not for DFSORT. However, some shops do have both with one installed as the "primary" sort and the other installed as the "secondary" sort product. In that case, the primary sort product is invoked automatically, and you'd need to STEPLIB to the correct libraries to invoke the secondary sort product. Since Syncsort was invoked automatically, it's your primary sort product. Your System Programmers can tell you if your shop has a license for DFSORT and, if so, the libraries you need to STEPLIB to in order to use it.
Back to top
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Wed Mar 22, 2006 12:09 am
Reply with quote

Frank,thanks for this.

Can we use IF THEN with SYNCSORT (I need to replace YYYYMMDD with current date only if the records have YYYYMMDD in the 35th position). Tried using IF THEN WHEN, but got the same error message again.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Mar 22, 2006 1:37 am
Reply with quote

You answered your own question: IFTHEN and OVERLAY are only supported by DFSORT.
Back to top
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Wed Mar 22, 2006 3:22 am
Reply with quote

I have this piece of code

OUTREC FIELDS=(1:1,34,35,8,CHANGE=(8,C'YYYYMMDD',DATE1), +
NOMATCH=(35,8),42)

The above piece of code throws an error, coz I guess DATE1 is not supported by syncsort

P.S I ran the job

OUTREC FIELDS=(1:1,34,35,8,CHANGE=(8,C'YYYYMMDD',C'HELLOHEL'), +
NOMATCH=(35,8),42)


it worked fine
Back to top
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Wed Mar 22, 2006 3:46 am
Reply with quote

Is there any other way to do this(IF YYYYMMDD replace it with current date in position 35 ELSE no change) in syncsort
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To get the the current time DFSORT/ICETOOL 13
Search our Forums:

Back to Top