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
 

 

Display the group variable which has Comp-3 fields

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

New User


Joined: 28 Sep 2006
Posts: 4

PostPosted: Wed Dec 06, 2006 8:55 pm    Post subject: Display the group variable which has Comp-3 fields
Reply with quote

Can someone help me with the below prob.

01 WS-KEY-FIELD.
03 WS-KEY1 S999 COMP-3 VALUE +0.
03 WS-KEY2 S999 COMP-3 VALUE +0.
03 WS-KEY3 S9(16) COMP-3.
MOVE WS-KEY3-NO TO WS-KEY3.

MOVE WS-KEY-FIELD TO KEY-FIELD.
DISPLAY 'KEY1: ' KEY1
DISPLAY 'KEY2: ' KEY2
DISPLAY 'KEY3: ' KEY3
DISPALY 'WHOLE KEY:' KEY-FIELD
DISPALY 'WHOLE KEY:' WS-KEY-FIELD


When i displayed KEY1, KEY2 and KEY3, it is displaying as:-
000
000
1234567891234567

but when i try to display key-field and ws-key-field the result is junk value.

Why it is not displaying the below value:-

0000001234567891234567


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

hariavinash

New User


Joined: 04 Jan 2006
Posts: 64

PostPosted: Wed Dec 06, 2006 11:03 pm    Post subject:
Reply with quote

you will have to move the comp-3 field to a alpha/numric field to get this displayed in readable way.

cheers
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: Thu Dec 07, 2006 2:24 am    Post subject:
Reply with quote

Hello,

To work corrently, the DISPLAY statement needs elementary items (it will convert packed and binary number fields to diaplayable data) or group items that contain "printable" characters.

Your group field has nothing that will be properly visable when displayed. What you are seeing is the "printable" version of the hex values in those bytes.
Back to top
View user's profile Send private message
shalini_devi

New User


Joined: 28 Sep 2006
Posts: 4

PostPosted: Thu Dec 07, 2006 7:32 am    Post subject:
Reply with quote

But the problem is, the key is in comp field, i need to read the VSAM file with this key.

The VSAM key feild will be as below. So i m moving the numeric value(WS-KEY3-NO ) into the ws-key3(comp field) and move into the key-field to read in the VSAM file.

01 KEY-FIELD.
03 KEY1 S999 COMP-3 VALUE +0.
03 KEY2 S999 COMP-3 VALUE +0.
03 KEY3 S9(16) COMP-3.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Dec 07, 2006 7:56 am    Post subject:
Reply with quote

Throwing my last two bits in,,,

VSAM does not give a dang what the key is, if yow use packed data a part of the key, then it is on your head to keep providing the same bit pattern for that key!.... icon_rolleyes.gif

Need more info? Reply......
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: Thu Dec 07, 2006 8:23 am    Post subject:
Reply with quote

Hello,

This should not be a problem for reading via the key - you just won't be able to do the group DISPLAY.

If there is any way to redefine the VSAM file it would be advisable to not use signed or packed numerics as keys.
Back to top
View user's profile Send private message
shalini_devi

New User


Joined: 28 Sep 2006
Posts: 4

PostPosted: Thu Dec 07, 2006 8:43 am    Post subject:
Reply with quote

Ohh ok. So group display is not allowed.

How should i code if i want to read the vsam file with only the KEY3.

I doesn't have KEY1 and KEY2 but i have only KEY3.

Is this code will work:-
The KEY-FILE layout
01 KEY-FIELD.
03 KEY1 S999 COMP-3 VALUE +0.
03 KEY2 S999 COMP-3 VALUE +0.
03 KEY3 S9(16) COMP-3.

Program:-

01 WS-KEY-FIELD.
03 WS-KEY1 S999 COMP-3 VALUE +0.
03 WS-KEY2 S999 COMP-3 VALUE +0.
03 WS-KEY3 S9(16) COMP-3.

MOVE WS-KEY3-NO TO WS-KEY3.

MOVE WS-KEY1 TO KEY1.
MOVE WS-KEY2 TO KEY2.
MOVE WS-KEY3 TO KEY3.

START KEY-FILE KEY GREATER THAN KEY-FIELD.
IF KEYFILE-STATUS = 0
READ KEY-FILE
IF KEYFILE-STATUS = 0
IF WS-KEY-FIELD = KEY-FIELD
MOVE NAME TO WS-NAME
ELSE
GO TO 2-EXIT
END-IF
END-IF
END-IF.
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: Thu Dec 07, 2006 8:50 pm    Post subject:
Reply with quote

Hello,

Not to sound too picky, but you cannot read the file with "only" key 3 as you've described the situation. The key1 and key2 fields had some value in them when the record was added and to directly retrieve it via the 3-field key, you must provide the same value that was used when the record was added.

If the record(s) were added without control over the values in key1 and key2, you might consider at least rebuilding the file with known initial values.

If you just don't care about what values are in key1 and key2, but want to read ALL records that match the value you specify for key3 you could define an ALTERNATEINDEX for the key3 field.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Dec 09, 2006 9:09 pm    Post subject: u
Reply with quote

Just to keep things straight: group displays ARE allowed. They just display what you ASKED FOR not what you WANT.

I display a group when I want to see what is ACTUALLY in the field(s) because DISPLAY will NOT attempt to CONVERT what's in the field(s) when displaying a group.
Back to top
View user's profile Send private message
Nighthawk750

New User


Joined: 04 Nov 2006
Posts: 20
Location: Amsterdam

PostPosted: Mon Dec 11, 2006 12:17 pm    Post subject: Re: u
Reply with quote

mmwife wrote:
Just to keep things straight: group displays ARE allowed. They just display what you ASKED FOR not what you WANT.

I display a group when I want to see what is ACTUALLY in the field(s) because DISPLAY will NOT attempt to CONVERT what's in the field(s) when displaying a group.


And if can add a small thing (hope it is not an open door :) )
: you can always switch to HEX ON....then the "printed rubbish" can be read.
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 Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Display ZEDLMSG without Pressing F1 &... anandgbe CLIST & REXX 8 Thu Dec 15, 2016 4:20 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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