Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Replace this YYYYMMDD with the current date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Replace this YYYYMMDD with the current date
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 Moderator


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

PostPosted: Tue Mar 21, 2006 3:53 am    Post subject:
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    Post subject: Re: Date function
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    Post subject: Re: Date function
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 Moderator


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

PostPosted: Tue Mar 21, 2006 6:37 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Mar 21, 2006 9:06 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed Mar 22, 2006 1:37 am    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us