View previous topic :: View next topic
|
Author |
Message |
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Hi Team,
I am facing an issue with FINDREP while trying to replace a text with number.
I have two texts in my input file namely - YYYYMMDD and HHMMSS which I am trying to replace with the value returned from the date time variables - &DATE1 AND &TIME1, but when I run the job its giving me SYNTAX error.
Can you please let me know how to achieve this ?
SYSIN:
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC FINDREP=(INOUT=(C'YYYYMMDD',&DATE1,C'HHMMSS',&TIME1)) |
Note: Instead of &DATE1 if I am using another string it works fine. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
How about using INREC IFTHEN to OVERLAY current date/time based on input position, instead of FINDREP.
FINDREP is used to find and replace constants within the input data record.
FINDREP Output Constant Rules wrote: |
An output constant can be specified as a null string, a single character string, a repeated character string, a single hexadecimal string, or a repeated hexadecimal string. The syntax is: C'' (null), C'string',nC'string', X'string' or nX'string'. n can be 1 to 256. |
IIRC current date/time constants can be 'inserted' only with INREC/OUTREC/OUTFIL BUILD or OVERLAY parameters. |
|
Back to top |
|
|
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Arun Raj wrote: |
How about using INREC IFTHEN to OVERLAY current date/time based on input position, instead of FINDREP.
FINDREP is used to find and replace constants within the input data record.
FINDREP Output Constant Rules wrote: |
An output constant can be specified as a null string, a single character string, a repeated character string, a single hexadecimal string, or a repeated hexadecimal string. The syntax is: C'' (null), C'string',nC'string', X'string' or nX'string'. n can be 1 to 256. |
IIRC current date/time constants can be 'inserted' only with INREC/OUTREC/OUTFIL BUILD or OVERLAY parameters. |
Thanks for the info. I have the solution using overlay, but I want to make it more generic and not based on static position. Thought FINDREP could be used, but it seems I have to go back to overlay method if this is not going to work |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Well then you can use dynamic system symbols in your SYMNAMES and use those symbols in your FINDREP.
Something like this:
Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
DATE-IN,S'&LYR4.&LMON.&LDAY.'
TIME-IN,S'&LHHMMSS.'
//SORTOUT DD SYSOUT=*
//SORTIN DD *
CON1-CON2
//SYSIN DD *
OPTION COPY
INREC FINDREP=(INOUT=(C'CON1',DATE-IN,C'CON2',TIME-IN)) |
SORTOUT
|
|
Back to top |
|
|
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Arun Raj wrote: |
Well then you can use dynamic system symbols in your SYMNAMES and use those symbols in your FINDREP.
Something like this:
Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
DATE-IN,S'&LYR4.&LMON.&LDAY.'
TIME-IN,S'&LHHMMSS.'
//SORTOUT DD SYSOUT=*
//SORTIN DD *
CON1-CON2
//SYSIN DD *
OPTION COPY
INREC FINDREP=(INOUT=(C'CON1',DATE-IN,C'CON2',TIME-IN)) |
SORTOUT
|
You are Awesome! Thanks a ton Arun |
|
Back to top |
|
|
|