|
View previous topic :: View next topic
|
| Author |
Message |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
| 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 |
|
 |
Frank Yaeger
DFSORT Developer

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:
| 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 |
|
 |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
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 |
|
 |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
| 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 |
|
 |
Frank Yaeger
DFSORT Developer

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). |
|
| Back to top |
|
 |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
| Where exactly in the job should I specify that the job needs to use DFSORT? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

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. |
|
| Back to top |
|
 |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| You answered your own question: IFTHEN and OVERLAY are only supported by DFSORT. |
|
| Back to top |
|
 |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
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 |
|
 |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|