I need to check if an alphanumeric field (say Seq No) of length = 8 has any SPACES in it.
e.g.
need to check if Seq No has any spaes [Seq No = 0001234b, where b = blank space],
If a blank space is found in the string, I need the final value as 00001234
Please provide the code snippet for the same.
INSPECTing a string in COBOL & updating the string
Moderators: dbzTHEdinosauer, Moderator Group
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
Why should you do it? The process providing the data should ensure it is correct. If it is not then send it back until it is correct. If it is a changed requirement then pass the change along to those who need to participate. Do not fix what should have been correct in the first place (or remember to charge a hefty fee for putting a band-aid on someone else's problem).
Regards
Nic
Nic
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
I know, you are right actually. But due to this few of the downstream jobs & few database tables are gettng impacted, so something has to be done to replace this blank space with something.NicC wrote:Why should you do it? The process providing the data should ensure it is correct. If it is not then send it back until it is correct. If it is a changed requirement then pass the change along to those who need to participate. Do not fix what should have been correct in the first place (or remember to charge a hefty fee for putting a band-aid on someone else's problem).
As of now, I have been asked to replace the entire field (Seq No) with 99999999 whenever this field is not NUMERIC (i.e. whenever it has this blank space), so that atleast the downstream system will know that this was the point were break/fix was applied.
Logically yours,
GRS
GRS
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Code: Select all
01 a-nice-name.
05 filler pic x(7).
05 filler pic x.
88 sequence-number-has-trailing-blank value space.
01 a-nice-name-for-this.
05 filler pic x value zero.
05 a-nice-receiving-name pic x(7).
if sequence-number-has-trailing-blank
move a-nice-name to a-nice-receiving-name
move a-nice-name-for-this to a-nice-name
end-if
Will the blank only be present in the last character?
Your request mentions that you are interested in ANY blank, but your examnple only shows a blank in the last position.
What if the value should have been 00012345 but is actually 0001234b? I suspect the all 9's would be less likely to cause confusion/problems.
Your request mentions that you are interested in ANY blank, but your examnple only shows a blank in the last position.
What if the value should have been 00012345 but is actually 0001234b? I suspect the all 9's would be less likely to cause confusion/problems.
Have a good one
-
- Active Member
- Posts: 67
- Joined: Thu Apr 05, 2012 1:29 am
- Location: WI, USA
Thanks William for the code.
@DikDude - I agree that the problem description is kindof confusing but as of now we have found another workaround for this. Now we won't be checking for blank space at any particular byte, instead if the field is not NUMERIC, will replace the entire field with '99999999' - that will be easier to track in downstream systems.
Thanks to both of u for ur time! Appreciate it.
@DikDude - I agree that the problem description is kindof confusing but as of now we have found another workaround for this. Now we won't be checking for blank space at any particular byte, instead if the field is not NUMERIC, will replace the entire field with '99999999' - that will be easier to track in downstream systems.
Thanks to both of u for ur time! Appreciate it.
Logically yours,
GRS
GRS
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page