Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Edited picture class for COMP-3 logic error

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Tue Oct 15, 2013 2:26 pm    Post subject: Edited picture class for COMP-3 logic error
Reply with quote

Hi,

I'm getting incorrect data in a file due to my edited picture class logic error.
A layout of file copybook is like this.
Code:

01 ws-record pic x(1020).
01 WS-TRLR REDEFINES WS-RECORD.
     03 WS-TRL-NAME PIC X(51)
     03 WS-TRL-A PIC X(969).
     03 WS-TRL-B REDEFINES WS-TRL-A
          05 WS-TRL-B-OC OCCURS 51 TIMES.
              07 WS-TRL-B-REC PIC ++++++++++++++9.99.
              07 FILLER PIC X.


Now my working storage variable which is used to populate ws-trl-b record is as follows.
Code:

01 WS-TMP-TRLR.
     03 WS-TMP-TRL-B.
          05 WS-TMP-TRL-B-OC OCCURS 51 TIMES.
              07 FILLER PIC X(9).
              07 WS-TMP-TRL-B-REC PIC S9(15)V9(2) COMP-3.
              07 FILLER PIC X VALUE ','.


Now before writing to the file i wrote the operation in COBOL as
MOVE 'DATA' TO WS-TRL-NAME
MOVE WS-TMP-TRL-B TO WS-TRL-B.
WRITE WS-RECORD.

Here, i'm not getting any compilation or run time errors. But, there is no edited picture class data in the file corresponding to WS-TRL-B-REC field. I'm having the data in COMP-3 format. I feel data in array variables is getting lost in this move operation.

Need some help in how to convert COMP-3 data in WS-TMP-TRL-B-REC which is 9 bytes to WS-TRL-B-REC edited pic which is of 18 bytes.
I'm trying to move the data for entire occurs 51 times array.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Tue Oct 15, 2013 3:11 pm    Post subject:
Reply with quote

A group level move, which is what you are doing, will NOT handle COMP, COMP-3, or edited numeric variables. The entire group of data is moved as if it were PIC X(?) -- hence the results you got. If you want your COMP-3 variable to move to the edited numeric variable, you need to move elementary variable to elementary variable.
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Tue Oct 15, 2013 3:28 pm    Post subject:
Reply with quote

So you mean to say, i need to remove the present layout of this variables and write seperate individual variables for facilitating comp-3 to edit pic variables movement?
I've almost 51 fields to be written in output. icon_sad.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Oct 15, 2013 3:35 pm    Post subject:
Reply with quote

No, you need merely MOVE WS-TMP-TRL-B-REC (I) TO WS-TRL-B-REC (I) in a paragraph PERFORMed VARYING I FROM 1 TO 51.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Tue Oct 15, 2013 4:40 pm    Post subject: Reply to: Edited picture class for COMP-3 logic error
Reply with quote

Editing only occurs when the field with the edit pattern itself is the target of something.

You also seem to want the commas. When showing us code, it is nice if it does not produce compiler diagnostics. You should always check and correct things.

You could give your FILLER a name and MOVE COMMA to it in the same loop. Or you could be slack and MOVE ALL COMMA to the group item before your loop. Or you could be adventurous and try to include the comma in your edit picture. However, with 51 fields, it would generally be expected that there would be 50 commas. Perhaps you have more data afterwards?
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Tue Oct 15, 2013 5:51 pm    Post subject:
Reply with quote

Thanks Akatsukami. icon_smile.gif I couldn't think of this simple logic while coding.

Bill, Yes COMMA is important as i'm generating a CSV file. What i did was, added one extra line "MOVE ',' TO WS-COMMA(I)" inside the perform. So i'm able to generate COMMAS in sequence.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts Error IEC161I 052(009,XXXRS00)-084 wh... amitc23 JCL & VSAM 10 Wed Oct 12, 2016 5:00 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us