IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can we use edited picture clause in comp items?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kolappan

New User


Joined: 26 May 2006
Posts: 5

PostPosted: Fri May 26, 2006 10:59 am
Reply with quote

Hi,
for example,

can we write working section as
01 a pic 9(3).9(2) comp. ------Is it possible?

we can write
01 a1 pic 9(3)v9(2) comp.

my question is
move 345.78 to a
move 345.78 to a1
what is the output of a and a1?
Back to top
View user's profile Send private message
rdr

New User


Joined: 26 May 2006
Posts: 35
Location: india

PostPosted: Fri May 26, 2006 11:04 am
Reply with quote

Hi Kolappan,

I am answering to the later part of the question-
Please let me know if i am wrong....


Quote:
my question is
move 345.78 to a
move 345.78 to a1
what is the output of a and a1?



Out put is 345.78-a
345.78-a1

Regards,
Rohit.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun May 28, 2006 10:46 pm
Reply with quote

A def of a decimal number (regardless of the type - comp, display, comp-3) is separate and distinct from its edited def.

To edit a numeric field you must MOVE it to an edited field or provide a value in the edited def. So there are no COMP (or NUMERIC DISPLAY, for that matter) edited fields, only edited fields.

So, in your example, fld a is invalid and should cause a compiler error. If you recode it as a pic 9(3).9(2) you can move 345.78 to it and it will display as 345.78.

You can also move 345.78 to fld a1 then move field a1 to fld a and fld a will display as 345.78.

Answering your 2nd ques with the new defs:

a1 should contain X'00008712'

If you move it to fld a it should display as 345.78

I haven't tested any of this but it gives you a good foundation to try it for yourself.
Back to top
View user's profile Send private message
kolappan

New User


Joined: 26 May 2006
Posts: 5

PostPosted: Mon May 29, 2006 12:43 pm
Reply with quote

Hi Mmwife,

Thanx for your kind reply.

Regards,
Kolappan.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue May 30, 2006 3:17 am
Reply with quote

Hi Kolappan,

I hope it's enough to get you started.

I forgot to mention that the editing takes place as a by-product of the data conversion process of function being performed (e.g. MOVE).
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts To search DB2 table based on Conditio... DB2 1
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
Search our Forums:

Back to Top