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
 

 

Which PIC clause to use space in alphanumeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Which PIC clause to use space in alphanumeric
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    Post subject: Re: what cud be the PIC clause?
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    Post subject:
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    Post subject: Re: Which PIC clause to use space in alphanumeric
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: 1226
Location: Israel

PostPosted: Sun Oct 22, 2006 9:03 pm    Post subject:
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: 1452
Location: Chicago, IL

PostPosted: Mon Oct 23, 2006 7:05 am    Post subject: Re: Which PIC clause to use space in alphanumeric
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    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
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm
No new posts alphanumeric sequence generation sivaprasad.gadhi COBOL Programming 6 Wed Mar 30, 2016 3:03 am


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