Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Search for hard coded DB2 timestamp in cobol source

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sprikitik

New User


Joined: 29 Jan 2007
Posts: 58
Location: Makati City, Philippines

PostPosted: Fri Apr 20, 2012 3:31 pm    Post subject: Search for hard coded DB2 timestamp in cobol source
Reply with quote

Hi,

Anybody has na idea on how to search for hard coded db2 timestamp in cobol source? Aside from manually going through all the prgrams.

I have 100 cobol programs and I wanted to check if there are hard coded timestamps in the programs.

Thanks!
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Apr 20, 2012 3:38 pm    Post subject: Reply to: Idea on Searching for Hard Coded Timestamp
Reply with quote

I'm not sure I understand you, but have you a product with which you can search a PDS/some other source library? If so, is that any use to you?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Fri Apr 20, 2012 3:40 pm    Post subject: Reply to: Idea on Searching for Hard Coded Timestamp
Reply with quote

it looks to me more an issue of pattern searching
since the timestamp <value> is unpredictable...
noo way with common searching tools , need to be creative icon_wink.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Apr 20, 2012 3:55 pm    Post subject: Reply to: Idea on Searching for Hard Coded Timestamp
Reply with quote

It the "timestamp" has been coded to cover the last decade-or-so it would start '20 or "20.

It can sometimes be "tricky" to get the correct number of quotes/apostrophes for such a case, and you may well get false hits (fewer if all the hard-coding is for 2010 onwards) but it will be "obvious" on the output what is a timestamp and what isn't.

If you are doing Greater than or Less than with the timestamp, you may well have a low-order part of the literal you could use to search for with even better results. Or both of them on the same line.

I can be wildly wrong, as I don't really know what you are talking about :-)
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Fri Apr 20, 2012 5:27 pm    Post subject:
Reply with quote

Hello,

Quote:
I have 100 cobol programs and I wanted to check if there are hard coded timestamps in the programs.


As suggested by enrico and bill, alteast parital values should be known to you to perform the search.

In your source PDS,

try giving the command
Code:
SRCHFOR '2012-04-'


to find the programs used the current year & current month.

Likewise, Modify on your need(might require to know the year,month) & do the search .
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Apr 20, 2012 5:48 pm    Post subject: Reply to: Idea on Searching for Hard Coded Timestamp
Reply with quote

In a COBOL Load Module, there is a date/time stamp which conforms to what is returned by the WHEN-COMPILED function.

You can visually find this within the first X'100' bytes of a given Load Module, by browsing the targeted loadlib using ISPF 3.4.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Fri Apr 20, 2012 5:58 pm    Post subject:
Reply with quote

don't forget the copybooks
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri Apr 20, 2012 6:49 pm    Post subject:
Reply with quote

within edit you can use following command to locate timestamps
Code:
find p'####$##$##$##$##$##'     


You could write a rexx that opens each member in edit, does above find and reports the returncode.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 654
Location: Whitby, ON, Canada

PostPosted: Fri Apr 20, 2012 8:00 pm    Post subject:
Reply with quote

GuyC wrote:
within edit you can use following command to locate timestamps
Code:
find p'####$##$##$##$##$##'     


You could write a rexx that opens each member in edit, does above find and reports the returncode.
Good one! One of my pet ISPF peeves is that the SRCHFOR command doesn't support picture strings. If it did, then you wouldn't have to write a rexx.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1232
Location: Israel

PostPosted: Mon Apr 23, 2012 5:10 pm    Post subject: Reply to: Idea on Searching for Hard Coded Timestamp
Reply with quote

Mabuhay, sprikitik !

I tried using ISRSUPC with the following statements:
Code:
  SRCHFOR  '-'     
  SRCHFORC '-',+3
  SRCHFORC '-',+3
  SRCHFORC '.',+3
  SRCHFORC '.',+3
It found the timestamps I scattered in my test pds.

Note: I didn't do extensive tests, there may be some false alerts too.
Back to top
View user's profile Send private message
sprikitik

New User


Joined: 29 Jan 2007
Posts: 58
Location: Makati City, Philippines

PostPosted: Thu Apr 26, 2012 1:30 pm    Post subject: Re: Reply to: Idea on Searching for Hard Coded Timestamp
Reply with quote

Marso wrote:
Mabuhay, sprikitik !

I tried using ISRSUPC with the following statements:
Code:
  SRCHFOR  '-'     
  SRCHFORC '-',+3
  SRCHFORC '-',+3
  SRCHFORC '.',+3
  SRCHFORC '.',+3
It found the timestamps I scattered in my test pds.

Note: I didn't do extensive tests, there may be some false alerts too.


Hey, SalamaT!

It worked!
Back to top
View user's profile Send private message
sprikitik

New User


Joined: 29 Jan 2007
Posts: 58
Location: Makati City, Philippines

PostPosted: Thu Apr 26, 2012 1:31 pm    Post subject:
Reply with quote

Thanks for all the replies! I appreciate it very much!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us