IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Handling sign while Moving


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srimsc_ibmmainframes

New User


Joined: 17 Feb 2004
Posts: 19
Location: pune

PostPosted: Fri Oct 21, 2005 12:21 pm
Reply with quote

Hi all


I am getting 11 chars length String (ex.0000001010{ , +0000090191, -0000020503 ) from Java People, once i get this i have to do two things.

1. If the Input is already overpunched ( ex: 0000001010{ ), i have to convert it into signed numeric (based on the overpunch '+' or '-') , i mean to the original value

2.If the Input is not overpunched (ex: +00000010101 )i have to convert it into overpunch format, for this case if the input string has '-' (minus) as first char my pgm shud be able to identify that (for this case i can simply use the input as base as it will come with '-' sign, but is there any logic in COBOL to identify this sign....?)


ex: +00000010101 (before overpunch )
0000001010A (after overpunch)

take the last char which is '1' and check the sign which is '+' , so these two will b converted to 'A'.


its urgent plz help me out.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Oct 22, 2005 8:57 pm
Reply with quote

Hi Reddy,

The { is a 0, the A is a 1, the B is a 2, etc., so I'm assuming that you mean 0000001010{ is already the way you want it and only the +/- numbers have to be converted to opunch.

If this is not correct, please provide an example of what 0000001010{ should be converted to; if what I assumed IS correct, you can try something like this:
Code:


01  your-orig-fld        pic  x(11).
01  hold-fld.
    05  hld-opch-fld     pic S9(11).
    05  hld-sinl-fld     redefines
        hld-opch-fld     pic S9(10) sign leading separate.

01  recv-fld             pic s9(11).


move your-orig-fld   to hold-fld
if hold-fld(1:1)    not numeric
   move hld-sinl-fld to recv-fld
else
   move hld-opch-fld to recv-fld
end-if

If " not numeric" doesn't work try " = ('+' or '-')".
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts File Handling COBOL Programming 9
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts SORT for dynamic trailer record + CSV... DFSORT/ICETOOL 14
This topic is locked: you cannot edit posts or make replies. regarding COBOL WRITE verb (VB File H... COBOL Programming 9
Search our Forums:

Back to Top