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

Which PIC clause to use space in alphanumeric


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

New User


Joined: 29 Jun 2006
Posts: 33

PostPosted: Tue Oct 17, 2006 5:38 pm
Reply with quote

i dont have the source code but this is the observation.....

X is an alphanumeric field containing 15 characters: 1234567<space>8<space><space><space><space><space><space>

this is moved to a field Y which report says contains <space><space><space>123456

what cud be the PIC clause of Y?
Back to top
View user's profile Send private message
sridevi2005

New User


Joined: 15 Sep 2005
Posts: 42

PostPosted: Tue Oct 17, 2006 5:46 pm
Reply with quote

I think PIC 9(6).
Back to top
View user's profile Send private message
mfhelp
Warnings : 1

New User


Joined: 29 Jun 2006
Posts: 33

PostPosted: Tue Oct 17, 2006 5:50 pm
Reply with quote

i dont think so coz if destination field had been numeric, filling wud have started from right side.......meaning rightmost of source to rightmost of destination.......now right side contains 6 spaces so Y wud have displayed all spaces.......

correct me if i m wrong.
Back to top
View user's profile Send private message
ihatesugar
Warnings : 1

New User


Joined: 22 Oct 2006
Posts: 43

PostPosted: Sun Oct 22, 2006 5:50 pm
Reply with quote

It has to be PIC(09) and if the movement must be right justified!!!
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sun Oct 22, 2006 9:03 pm
Reply with quote

Without the source code it is impossible to say exactly what happens.
Here are some possible solutions:
Code:
01  FIELD-X.
    03  FIELD-X1  PIC X(6).
    03  FIELD-X2  PIC X(9).
01  FIELD-Y  PIC X(9)  JUSTIFIED RIGHT.
01  FIELD-Z  PIC Z(9).

    MOVE FIELD-X(1:6) TO FIELD-Y
    MOVE FIELD-X(1:6) TO FIELD-Z
    MOVE FIELD-X1 TO FIELD-Y
    MOVE FIELD-X1 TO FIELD-Z

All these MOVEs lead to the same result.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Mon Oct 23, 2006 7:05 am
Reply with quote

What Marso shown would produce "$$$123456" to the output variable, where $= Spaces.
Coming to the original question:-
Quote:
what cud be the PIC clause of Y?

As you said value for this field is "$$$123456"
It is containing spaces- It cant be a numeric field.
It is having numbers- It cant be a alphabetic field.
It is having spaces & numbers- It MUST be an alphanumeric field.

So answer is X(9).
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts To search DB2 table based on Conditio... DB2 1
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
No new posts Allocated space calculation from DCOL... PL/I & Assembler 3
No new posts split a name based on space in ASM PL/I & Assembler 9
Search our Forums:

Back to Top