Splitting the digits using COBOL
Splitting the digits using COBOL
I have set of 10-digit numbers as input and i need to check only the first 2 digits of it whether it has changed or not. Rest will be unchnged. How can i split-up the digits using COBOL?
Regards,
Santhya
Santhya
-
- Global moderator
- Posts: 3006
- Joined: Fri Apr 18, 2008 11:25 pm
- Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
- Referer: www.ibmmainframes.com
Re: Splitting the digits using COBOL
using COBOL or anything programmable ( even a hand calculator ) the logic would be the same
isnt' that a pretty basic arithmetic question ?...
did You ever hear of something called division/dividend/divisor/quotients/reminder
isnt' that a pretty basic arithmetic question ?...
did You ever hear of something called division/dividend/divisor/quotients/reminder

cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
-
- Global moderator
- Posts: 3805
- Joined: Tue Jan 25, 2011 12:02 am
- Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
- Referer: Google
Re: Splitting the digits using COBOL
If I understand correctly:
Study the manuals about how to define data, REDEFINES can also be very useful for this sort of task (and could be used for your requirement).
Code: Select all
01 TEN-DIGIT-NUMBER.
05 TDN-FIRST-TWO PIC XX.
05 TDN-LAST-EIGHT PIC X(8).
Study the manuals about how to define data, REDEFINES can also be very useful for this sort of task (and could be used for your requirement).
Code: Select all
01 TEN-DIGIT-NUMBER PIC X(10).
01 FILLER REDEFINES TEN-DIGIT-NUMBER.
05 FIRST-TWO-OF-TEN-DIGIT-NUMBER PIC XX.
05 FILLER PIC X(8).
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: Splitting the digits using COBOL
Do not look at it as though you have a 10 digit number but rather as a 2 digit number followed immediately by an 8 digit number or any other combination that meets your requirement.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic