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

FINDREP Syntax Error


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Thu Mar 09, 2017 10:11 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Mar 09, 2017 10:34 pm
Reply with quote

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
View user's profile Send private message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Thu Mar 09, 2017 11:15 pm
Reply with quote

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 icon_sad.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Mar 10, 2017 12:06 am
Reply with quote

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
Code:
20170309-134023
Back to top
View user's profile Send private message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Fri Mar 10, 2017 12:37 am
Reply with quote

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
Code:
20170309-134023


You are Awesome! Thanks a ton Arun icon_smile.gif
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
Search our Forums:

Back to Top