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

Search for hard coded DB2 timestamp in cobol source


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sprikitik

New User


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

PostPosted: Fri Apr 20, 2012 3:31 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Apr 20, 2012 3:38 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 20, 2012 3:40 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Apr 20, 2012 3:55 pm
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Apr 20, 2012 5:48 pm
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: 6966
Location: porcelain throne

PostPosted: Fri Apr 20, 2012 5:58 pm
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
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: 765
Location: Whitby, ON, Canada

PostPosted: Fri Apr 20, 2012 8:00 pm
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: 1353
Location: Israel

PostPosted: Mon Apr 23, 2012 5:10 pm
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: 61
Location: Makati City, Philippines

PostPosted: Thu Apr 26, 2012 1:30 pm
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: 61
Location: Makati City, Philippines

PostPosted: Thu Apr 26, 2012 1:31 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top