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

DATA Convertion in batch process


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

New User


Joined: 26 Mar 2007
Posts: 9
Location: Argentina

PostPosted: Thu Dec 13, 2007 7:11 pm
Reply with quote

I have the following INPUT FILE for a batch process:

99040100 0120 300511999022619990226
99040100 0120 -126211999022619990226
99040100 0120 104581999030919990309
99040100 7100 128981999030919990309

I read it with this copy:

FD UNLD.
01 REG-UNLD.
03 UNLD-X1 PIC X(08).
03 UNLD-X2 PIC X(02).
03 UNLD-X3 PIC 9(04).
03 UNLD-X4 PIC S9(19).
03 UNLD-X5 PIC X(08).
03 UNLD-X6 PIC X(08).

and write it in another file with this format:

FD OUTFILE.
01 OUTFILE.
03 OUT-X1 PIC X(08).
03 OUT-X2 PIC X(02).
03 OUT-X3 PIC 9(04).
03 OUT-X4 PIC S9(9)V99.
03 OUT-X5 PIC X(08).
03 OUT-X6 PIC X(08).

99040100 0120000030051001999022619990226
99040100 0120000=12621001999022619990226
99040100 0120000010458001999030919990309
99040100 7100000012898001999030919990309

with the '-' replaced by a '='. Could someone tell me why this happening? I want the "000=1262100" to be an "0000001262q", how can i do this?
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Thu Dec 13, 2007 8:02 pm
Reply with quote

Here, You are moving S9(19) to S9(9)V99. Is it okay?

Correct me if I am wrong.
Back to top
View user's profile Send private message
pa3lo

New User


Joined: 26 Mar 2007
Posts: 9
Location: Argentina

PostPosted: Thu Dec 13, 2007 8:13 pm
Reply with quote

Yes, i'm actually doing that in my program, is it wrong to do it? what could be the problem with it?.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Dec 13, 2007 8:54 pm
Reply with quote

pa3lo wrote:
Yes, i'm actually doing that in my program, is it wrong to do it? what could be the problem with it?.


If you can't fiqure it out I am not going to bother explaining it.
Back to top
View user's profile Send private message
pa3lo

New User


Joined: 26 Mar 2007
Posts: 9
Location: Argentina

PostPosted: Thu Dec 13, 2007 9:17 pm
Reply with quote

Craq Giegerich wrote:
If you can't fiqure it out I am not going to bother explaining it.


Don't bother then, its been solved already, thank you.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Thu Dec 13, 2007 9:31 pm
Reply with quote

It's fine. Could you please share how to sove this?
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 177
Location: Seattle, WA

PostPosted: Thu Dec 13, 2007 9:49 pm
Reply with quote

Fairly simple, actually. He stated:


Quote:
Yes, i'm actually doing that in my program, is it wrong to do it? what could be the problem with it?.



If you don't want to see it, don't do it. Duh.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Dec 13, 2007 9:52 pm
Reply with quote

Try moving 123456789012345 to a pic 9(9)v99 field!
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 177
Location: Seattle, WA

PostPosted: Thu Dec 13, 2007 9:56 pm
Reply with quote

It truncates the high-order digits. According to Murach, the result "should" be 567890123.45
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Dec 13, 2007 10:01 pm
Reply with quote

socker_dad wrote:
It truncates the high-order digits. According to Murach, the result "should" be 567890123.45


Not according to any rules for cobol moves I have ever seen. Yes, it will truncate the high-order digits without any warning or error message that is the problem.
Back to top
View user's profile Send private message
pa3lo

New User


Joined: 26 Mar 2007
Posts: 9
Location: Argentina

PostPosted: Thu Dec 13, 2007 10:54 pm
Reply with quote

Modified the copy of the input file for this:

FD UNLD.
01 REG-UNLD.
03 UNLD-X1 PIC X(08).
03 UNLD-X2 PIC X(02).
03 UNLD-X3 PIC 9(04).
03 UNLD-SIGN PIC X.
03 UNLD-X4 PIC S9(18).

03 UNLD-X5 PIC X(08).
03 UNLD-X6 PIC X(08).

that way the sign will be storage in UNLD-SIGN, then i evaluate the value of it, if it's a '-' then i multiply UNLD-X4 BY -1 giving OUT-X4 the other way simply move the values.

Don't know if it's the best solution but it works.
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 Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts How to get a stack trace on a looping... ABENDS & Debugging 5
No new posts SCOPE PENDING option -check data DB2 2
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
Search our Forums:

Back to Top