Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Validate filler at specified position in COBOL

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

New User


Joined: 12 Aug 2005
Posts: 12

PostPosted: Sun May 13, 2007 6:13 pm    Post subject: Validate filler at specified position in COBOL
Reply with quote

I want to know whether can we validate a character at specified postion in cobol.

eg: 01 Name.
05 FirstName Pic X(10).
05 Filler Pic X value |.
05 LastName Pic X(20).

I want to know can we identify whether Symbol "|" (pipe) is present in between firstname and lastname.

and if the filler comes many times i mean at many positions is there any better way to validate it

Note: I cant change filler to variable name. icon_question.gif
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: Sun May 13, 2007 9:57 pm    Post subject:
Reply with quote

Hello,

Is this a one-time test or something that will become production eventually (more below)?

Are you using the fillers as a delimiter for a file you will download or is there some other use for the | character(s)?

As long as the | cannot be in any of the data fields, you could INSPECT the group field TALLYING the number of | characters. That would get you a count in one statement which could be compared against the expected number.

If you are only interested in certain ones you could check each position you are interested in by using reference modification (which means you need the actual displacement in the code - not my favorite choice as the layout may change making the reference modified code invalid).

The following applies more to code that will be promoted to production versus something that is for testing only.

Other than a bit of mis-guided direction, is there some business reason you cannot name fields that are no longer merely filler? Just because someone "says so" it not a business reason - it is just poor direction. As the field(s) are to be actually used in the code, they are no longer really "filler". Maybe names like pipe-1, pipe-2, etc could be incorporated as a standard and not ruffle the feathers of those are of the "can't name them" group.

Good luck icon_smile.gif
Back to top
View user's profile Send private message
ctuserman
Currently Banned

New User


Joined: 12 Aug 2005
Posts: 12

PostPosted: Sun May 13, 2007 11:01 pm    Post subject:
Reply with quote

yup this is due to buisness reason and filler "|"(pipe) is used to seperate values in sequential files and i need to make a check that this fillers do exist after every value in record except for the last one and i guess they do exist for atleast 20 times in a record

thanx for ur reply waiting for ur reply again.........
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: Mon May 14, 2007 2:30 am    Post subject:
Reply with quote

Hello,

I understand completely your requirement - when i create delimited files, i tend to use the tab chatacter (x'05') as it works well for data going either direction - the pipe character should work well also.

The part that is not a business requirement is that you cannot name the pipe fields. That is basically both nonsense and not your fault. As at many places, you will have to work within the rule. After our first exchange of info, i looked at some COBOL code and a few EasyTrieve modules people wrote before i came onsite and their code (in both languages) have FIELD-1 TAB-01 FIELD-2 TAB-02 or the coder used STRING to build the files to download. . .

One thing i most often do is create or use the delimited data with STRING or UNSTRING. If i string together several fields/values with delimiter characters i "know" the delimiter is in place and do not need to refer to it later to check it. This may or may not work for you.

If you must work within the current "rules", i'd probably choose the INSPECT/TALLY. As long as the number of delimiters does not change, the code will not need to change even if a field length was modified.

Good luck and let us know if there are any questions.
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Mon May 14, 2007 10:01 am    Post subject:
Reply with quote

Hi Dick,
Can this be one of the reasons of using FILLER insted of variable names ? When we INITAILIZE a group variable, all the variables under that group variable except FILLER are initialized depending on their PIC clause. But the FILLER value remains intact. So most of the times, to avoid handeling of these delimiters in code and to avoid the risk of them being initialized to something else, they are declared as FILLER.

--Parag
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: Mon May 14, 2007 11:45 am    Post subject:
Reply with quote

Hello Parag,

I suppose it could be icon_smile.gif

Very few of the applications i've helped build/support use the INITIALIZE statement - there has been little need to set everyting to spaces and zeros as many of the data items require something else for their "default" value.

If i wanted to use INITIALIZE to set initial values and protect a delimiter character in filler items, i'd not later try to make sure that the delimiters were still intact - if the only "move" to the group level was INITIALIZE, the fillers would be safe (as you pointed out).
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 965
Location: Richmond, Virginia

PostPosted: Mon May 14, 2007 5:55 pm    Post subject:
Reply with quote

If I were using INITIALIZE to clear all but FILLER's, in order to keep the delimiters in place, I'd surely at least want to comment this very clearly, as I think this would be a very infrequently used technique (trick?).

Proposal: Survey experienced COBOL programmers to see how many know that INITIALIZE leaves FILLER untouched.
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 Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us