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
 
Unpacking COMP-3 Field which has spaces Leads to "40404

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Mon Jul 09, 2007 7:02 pm    Post subject: Unpacking COMP-3 Field which has spaces Leads to "40404
Reply with quote

Hi,

I am Unpacking the COMP-3 fields to Numeric Fields (I have tried alphanumeric also).

The problem is as follows:


I have declared as:

WS-020-INFILE-PACKED17 PIC 9(017) COMP-3.
WS-020-OUTFILE-PACKED17 PIC X(017).

The movement is:

MOVE WS-020-INFILE-PACKED17 TO WS-020-OUTFILE-UNPACKED17.


Now, WS-020-INFILE-PACKED17 is all spaces in the file.


In the DISPLAYS , I get:

WS-020-INFILE-PACKED17 40404040404040404
WS-020-OUTFILE-UNPACKED17 40404040404040404


May I know why spaces are not coming and what should I do to not get the HEX values (for spaces) but get the spaces.
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Jul 09, 2007 7:14 pm    Post subject:
Reply with quote

Because the X'404040' becomes X'F4F0F4F004' which becomes X'F4F0F4F0F4' which is 40404.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Mon Jul 09, 2007 7:33 pm    Post subject:
Reply with quote

Change this, but you will need to enlarge the picture size

WS-020-OUTFILE-PACKED17 PIC X(017).

WS-020-OUTFILE-PACKED17 PIC 9(017).
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2007 9:39 pm    Post subject:
Reply with quote

Hello,

I believe this
Quote:
Change this, but you will need to enlarge the picture size
WS-020-OUTFILE-PACKED17 PIC X(017).
WS-020-OUTFILE-PACKED17 PIC 9(017).
is typo'ed.

If you have these fields
Quote:
WS-020-INFILE-PACKED17 PIC 9(017) COMP-3.
WS-020-OUTFILE-PACKED17 PIC X(017).
and want leading spaces before the actual digits, change WS-020-OUTFILE-PACKED17 PIC X(017) to WS-020-OUTFILE-PACKED17 PIC ZZZZZZZZZZZZZZZZ9. If you want leading zeros, use the PIC 9(17) recommended previoiusly. It would also be a good idea to make the field name more informative.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Jul 10, 2007 1:09 am    Post subject:
Reply with quote

You can try:
Code:
 WS

WS-020-INFILE-PACKED17    PIC 9(017) COMP-3.
WS-020-INFILE-X           REDEFINES
WS-020-INFILE-PACKED17    PIC X(009).
WS-020-OUTFILE-PACKED17   PIC X(017).

PD

IF WS-020-INFILE-PACKED17 IS NOT NUMERIC     
   AND
   WS-020-INFILE-X = SPACES
   MOVE SPACES TO WS-020-OUTFILE-PACKED17
ELSE
   MOVE WS-020-INFILE-PACKED17 TO WS-020-OUTFILE-PACKED17   
END-IF



This assumes SPACES is the only non-packed value you'll have in your IP.
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
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm

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