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
 

 

How we write pic class for 7890 in comp 3 & COMP Var

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
reena_preethi

New User


Joined: 14 Jun 2006
Posts: 14

PostPosted: Sun Jul 09, 2006 12:11 pm    Post subject: How we write pic class for 7890 in comp 3 & COMP Var
Reply with quote

hello friends
i having i doubt regarding comp variables.
suppose if i store 7890 in comp3 var how it stores?
how it stores in comp var?
how we write pic class for 7890 in comp 3 & COMP var?

thanks in advance
preethi
Back to top
View user's profile Send private message

janamott

New User


Joined: 22 Dec 2005
Posts: 4
Location: Edison, NJ

PostPosted: Wed Jul 12, 2006 1:09 am    Post subject:
Reply with quote

A packed or comp-3 field occupies a number of spaces equal to (pic-clause-length / 2) + 1.

Drop any remainder when you divide the pic clause length by 2.

A field defined as PIC 9(4) COMP-3 will occupy only 3 bytes in storage ((4 / 2) + 1 ) = 3.

However, don't define your pic clause as only 3 bytes. It should be long enough for all your unpacked data.

In your example, your pic clause will be

01 WS-FIELDS.
05 TEST-COMP3-SIGNED PIC S9(4) COMP-3.

And your packed data will appear this way

080
79C

If you don't want a sign (c=positive, d=negative), your pic clause will be

05 TEST-COMP3-UNSIGNED PIC 9(4) COMP-3.

And your data will look like this

080
79F


A comp field also needs to have a pic clause long enough for all the field's unpacked data.

In your example, your pic clause can be either of the following

05 TEST-COMP-SIGNED PIC S9(4) COMP.
05 TEST-COMP PIC 9(4) COMP.

And your data will be stored like this

1D
E2
Back to top
View user's profile Send private message
reena_preethi

New User


Joined: 14 Jun 2006
Posts: 14

PostPosted: Thu Jul 13, 2006 11:47 am    Post subject:
Reply with quote

thanks a lot janamott

regards
preethi
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Write R1 and R2 to OP1 and R1 to OP2 bhaskar_kanteti DFSORT/ICETOOL 10 Fri Mar 03, 2017 11:18 am
No new posts Can you write 2 recs on SORTOUT when ... Sysaron DFSORT/ICETOOL 6 Thu Feb 23, 2017 12:07 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 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 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