Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

Google
 
Web mainframegurukul.com

Find and Replace string with current Date

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
jathampy
Member


Joined: 26 Sep 2009
Posts: 22
Location: software engineer

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Jul 23, 2010 3:43 am    Post subject: Find and Replace string with current Date Reply with quote

My requirement is to replace the '########' string with current date in a SFTP control member.

Input
PWD
ls -l
get 'ETOLDAG_000003_########.csv' 'UGLXCD.EBAXMD.NETWORK.TEST'
rename 'ETOLDAG_000003_########.csv' 'ETOLDAG_000003_########.csv.taken'
quit

Output
PWD
ls -l
get 'ETOLDAG_000003_20100722.csv' 'UGLXCD.EBAXMD.NETWORK.TEST'
rename 'ETOLDAG_000003_20100722.csv' 'ETOLDAG_000003_20100722.csv.taken'
quit

I have coded the jcl given below to satisfy my current requirement. The same SFTP control card will be used in future to handle additional files. The current solution depends on the position of the string '########' and won't work if the filename character is increased

Can this be handled using FINDREP or any alternative solution to search the string at any position and replace with current date.?


/FTPCRE EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD PATH='/u/TST169/sftpinpa',PATHOPTS=ORDONLY,
// LRECL=80,RECFM=FB,FILEDATA=TEXT
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(22,8,CH,EQ,C'########'),OVERLAY=(22:DATE1)),
IFTHEN=(WHEN=(25,8,CH,EQ,C'########'),OVERLAY=(25:DATE1)),
IFTHEN=(WHEN=(31,8,CH,EQ,C'########'),OVERLAY=(31:DATE1))
//*
//SORTOUT DD PATH='/u/TST169/sftpinpa',PATHOPTS=OWRONLY,
// LRECL=80,RECFM=FB,FILEDATA=TEXT
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Jul 23, 2010 3:58 am    Post subject: Reply with quote

A DFSORT job like this should do it:

Code:

/FTPCRE   EXEC  PGM=SORT
//SYMNAMES DD *
Mydate,S'&YR4.&MON.&DAY'
//SYSOUT   DD SYSOUT=*
//SORTIN     DD PATH='/u/TST169/sftpinpa',PATHOPTS=ORDONLY,
//       LRECL=80,RECFM=FB,FILEDATA=TEXT
//SYSIN    DD *
  OPTION COPY
  OUTREC FINDREP=(IN=C'########',OUT=Mydate)
//*
//SORTOUT    DD PATH='/u/TST169/sftpinpa',PATHOPTS=OWRONLY,
//       LRECL=80,RECFM=FB,FILEDATA=TEXT

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Mon Jul 26, 2010 8:30 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
jathampy
Member


Joined: 26 Sep 2009
Posts: 22
Location: software engineer

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Jul 23, 2010 9:15 pm    Post subject: Reply with quote

The solution provided by you worked. Thanks Frank fro your timely help.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1625
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Sat Jul 24, 2010 3:30 pm    Post subject: Reply with quote

Hi Frank,

This example looks pretty different than what I've seen with SORT applications, what does
Code:

//SORTIN     DD PATH='/u/TST169/sftpinpa',PATHOPTS=ORDONLY,
//       LRECL=80,RECFM=FB,FILEDATA=TEXT
//SYSIN    DD *
in SORTIN tell the sort-program? May be I'm overlooking the obvious, however, please assist me to understand it.

Thanks for your time.
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jul 26, 2010 8:29 pm    Post subject: Reply with quote

It's a z/OS UNIX file. Here's an example in the DFSORT APG:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA40/10.5.13?DT=20090527161936

and here are some references:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA40/1.9?DT=20090527161936
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1625
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Jul 27, 2010 12:25 pm    Post subject: Reply with quote

Thank you Frank - this helps.
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
jack98
Member


Joined: 20 Mar 2014
Posts: 1

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Mar 20, 2014 1:07 am    Post subject: Reply with quote

Hi Mr Yaeyer.

About >>
OUTREC FINDREP=(IN=C'########',OUT=Mydate)
<<

Let's say that the search/replace-string is ALWAYS on the first line. How do we code to findrep ONLY on the 1st line ?
OUTREC IFTHEN=(WHEN ... FINDREP...)

Thank you.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
William Collins
Active Member


Joined: 24 May 2012
Posts: 732

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Mar 20, 2014 3:13 am    Post subject: Reply with quote

If there is something in a fixed position with a value, or even an otherwise unique value to identify the first record, you can use that. If not, you can append/prepend a sequence number and test for a value of one,
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
DikDude
Moderator


Joined: 22 Jul 2011
Posts: 1001
Location: usa

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Mar 20, 2014 9:57 pm    Post subject: Reply with quote

Welcome to the forum!

Fist of all, the name is Yaeger - it is important to use the correct name ahen a name is used.

Second - please do NOT address a question to a particular individual. In this case, Frank is no longer on the forum. He retired a year ago.

And last - it is best to start a new topic for your new question rather than posting a reply to a topic that has been dormant 3+ years. A link to the original topic may be included in ypour post if you want to refer to some other topic.

Good luck and enjoy the forum Smile
_________________
Have a good one
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 9:42 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-5223.html