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
 

 

Moving a Group variable to fixed length one.

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

New User


Joined: 01 Oct 2008
Posts: 12
Location: India

PostPosted: Tue Mar 02, 2010 1:37 am    Post subject: Moving a Group variable to fixed length one.
Reply with quote

Hi
I have 2 group variables one is TEST-VAR second one RESULT-KEY

Code:
01  TEST-VAR.                                   
    05 TEST-A       PIC S9(01) COMP-3.
    05 TEST-B       PIC S9(01) COMP-3.
    05 TEST-C       PIC S9(05) COMP-3.
    05 TEST-D       PIC S9(05) COMP-3.

01  RESULT-KEY.                                     
    05 RESULT-ROG                 PIC X(4).         
    05 RESULT-FACILITY           PIC X(4).         
    05 RESULT-TESTABCD         PIC S9(12) COMP-3.


I would like to have the TEST-VAR as whole in RESULT-TESTABCD.
( concatenated TEST-A,TEST-B,TEST-C,TEST-D)

Is it possible to move the group variable to a fixed length one ?
How can we achieve this in minimum steps ?



Thanks
Back to top
View user's profile Send private message

agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Tue Mar 02, 2010 1:46 am    Post subject:
Reply with quote

Yes it is possible but it will be alphanumeric to numeric move.
What result are you expecting here, can you explain with an example?
Back to top
View user's profile Send private message
Tone

New User


Joined: 01 Oct 2008
Posts: 12
Location: India

PostPosted: Tue Mar 02, 2010 1:51 am    Post subject:
Reply with quote

one sample value is

TEST-A is 2
TEST-B is 5
TEST-C is 74536
TEST-D is 88123

I would like to have 257453688123 in RESULT-TESTABCD.

PS: I won't be able to changes the the above mentioned variable declarations, but i can define new ones to achieve this.


Thanks
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Tue Mar 02, 2010 2:09 am    Post subject:
Reply with quote

Tone wrote:
TEST-A is 2
TEST-B is 5
TEST-C is 74536
TEST-D is 88123

I would like to have 257453688123 in RESULT-TESTABCD
As I see it, what you really have in hex is:
TEST-A is 2C
TEST-B is 5C
TEST-C is 74536C
TEST-D is 88123C
And the results:
RESULT-ROG is 2C5C7453
RESULT-FACILITY is 6C88123C
RESULT-TESTABCD is 40404040404040

The sending field is eight bytes while the receiving field is fifteen bytes.
From your sample, just what do you want to see in the result fields?
Back to top
View user's profile Send private message
Tone

New User


Joined: 01 Oct 2008
Posts: 12
Location: India

PostPosted: Tue Mar 02, 2010 2:49 am    Post subject:
Reply with quote

For the sample mentioned,
Whether it is hex or not, I want equivalent of 257453688123 in RESULT-TESTABCD.

So that i can use in condition checks
eg: If CORRECT-KEY = RESULT-KEY ?


Thanks
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Mar 02, 2010 2:58 am    Post subject:
Reply with quote

Hello,

Move the 4 TEST fields to 4 fields that are defined as unsigned zoned decimal:
Code:
01  the-group.
    05 t-a pic 9.
    05 t-b pic 9
    05 t-c pic 9(5).
    05 t-d pic 9(5).
01  the-group-n redefines the-group pic 9(12).

After the move, you should have what you want.
Back to top
View user's profile Send private message
Tone

New User


Joined: 01 Oct 2008
Posts: 12
Location: India

PostPosted: Tue Mar 02, 2010 3:34 am    Post subject:
Reply with quote

Thank you !
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Mar 02, 2010 4:35 am    Post subject: Reply to: Moving a Group variable to fixed length one.
Reply with quote

You're welcome - good luck icon_smile.gif

d
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Mar 02, 2010 10:19 am    Post subject:
Reply with quote

Dick's solution is probably the best, but you could get what you desire into RESULT-TESTABCD by using the following untested code:
Code:

COMPUTE RESULT-TESTABCD
      = TEST-A * 100000000000
      + TEST-B *  10000000000
      + TEST-C *       100000
      + TEST-D
END-COMPUTE
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Why TS/OP would Not contact site supp... RahulG31 All Other Mainframe Topics 2 Wed Mar 22, 2017 7:46 am
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm


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