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
 

 

String Manipulation Using COBOL

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

New User


Joined: 03 Sep 2007
Posts: 16
Location: India

PostPosted: Wed Nov 25, 2009 9:44 am    Post subject: String Manipulation Using COBOL
Reply with quote

Hi All,

I have below requirements and I appriciate if someone can help me.

I have a address Line of 30 Bytes lenght i.e. let's say Address PIC X(30).

I need to search this Address string for a particular string "CONFIDENTIAL" or "confidential" (Both Capital o small case letter may exist). If I found a hit then i will follow another logic.

Second requirment -

In the same string of X(30), I need to search for a particular date patteren like '%_/_/_%' or '%_-_-_%'.

Can anybody guide me if it's possible to do this Logic using COBOL?

Thanks for help.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Nov 25, 2009 10:07 am    Post subject:
Reply with quote

Hello,

Using an inspect for the string, and an array (or more than 1), or reference modification, you can accomplish the pattern match within a couple of loops.

You need to determine which patterns are valid and then alllow for all valid patterns in the code. Until you have well established the "rules" coding would be premature.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1239
Location: Richfield, MN, USA

PostPosted: Wed Nov 25, 2009 10:10 am    Post subject:
Reply with quote

I think INSPECT finds occurrences of 'confidential' regardless of case. Test it and let us know.
Back to top
View user's profile Send private message
Deepak Dash

New User


Joined: 03 Sep 2007
Posts: 16
Location: India

PostPosted: Wed Nov 25, 2009 1:59 pm    Post subject: String Manipulation using COBOL
Reply with quote

Hi Terry,

Thanks. INSPECT does work and also gives me the count. Can you please let me know how do I find the date patteren in my string?

like '%_/_/_%' or '%_-_-_%'.

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

New User


Joined: 25 May 2005
Posts: 3
Location: Hyderabad

PostPosted: Wed Nov 25, 2009 2:39 pm    Post subject: Reply to: String Manipulation Using COBOL
Reply with quote

similarly you can do 'INSPECT' for '/ 'or '-' , 3rd and 6th byte using reference modification
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Nov 25, 2009 8:39 pm    Post subject:
Reply with quote

Hello,

INSPECT won't be much help for doing the pattern match. It might be used to find the first position, but i'd not try to say until the rules have all been shown.

The code will need to parse across the data until a potential beginning-of-pattern is found. Will the pattern always start and end with %? Could there be more than one pattern in the data? What is to happen when a pattern is found? Are single-digit month and day valid?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1239
Location: Richfield, MN, USA

PostPosted: Wed Nov 25, 2009 9:05 pm    Post subject:
Reply with quote

Dick, I think Deepak is using % as a wildcard character, not literally a percent sign.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Nov 25, 2009 9:56 pm    Post subject: Reply to: String Manipulation Using COBOL
Reply with quote

Hi Terry,

Very possibly. . . Maybe something more useful will follow. . .

d
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
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


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