Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts question about dfsms management clas... Hervey Martinez IBM Tools 0 Tue Oct 10, 2017 6:19 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us