Splitting the digits using COBOL



Splitting the digits using COBOL

Postby Santhya » Fri Oct 14, 2011 11:48 am

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
 
Posts: 7
Joined: Tue Oct 04, 2011 12:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Splitting the digits using COBOL

 

Re: Splitting the digits using COBOL

Postby enrico-sorichetti » Fri Oct 14, 2011 12:04 pm

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 :D
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-sorichetti
Global moderator
 
Posts: 2636
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 129 times

Re: Splitting the digits using COBOL

Postby BillyBoyo » Fri Oct 14, 2011 12:13 pm

If I understand correctly:

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).

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).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Splitting the digits using COBOL

Postby NicC » Fri Oct 14, 2011 5:04 pm

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
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Splitting the digits using COBOL

Postby Santhya » Wed Oct 19, 2011 2:31 pm

Thanx for the reply.
Regards,
Santhya
Santhya
 
Posts: 7
Joined: Tue Oct 04, 2011 12:20 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Stupid Questions

 


  • Related topics
    Replies
    Views
    Last post