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!!
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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:
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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).
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.
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.