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

changing datatype of a field from COMP-3 to DISPLAY


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
NB Gautam

New User


Joined: 29 Aug 2008
Posts: 8
Location: bhubaneswar

PostPosted: Sat Aug 30, 2008 9:21 pm
Reply with quote

Hi All,

I have a file with few fields having COMP-3 usage.
Now I need to change the usage from COMP-3 to DISPLAY. I can very well do through COBOL but i need to do through JCL. Is there any JCL utilitiy to do this job.

can anyone help?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Aug 30, 2008 9:29 pm
Reply with quote

COMP-3 is equivalent to DFSORT's PD format. DISPLAY is equivalent to DFSORT's ZD format. See:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/C.3?DT=20060615185603

You can convert from PD to ZD with DFSORT statements like this:

Code:

    OPTION COPY
    INREC BUILD=(...,p,m,PD,TO=ZD,LENGTH=n,...)


See the following for more information on conversion:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.7?DT=20060615173822

If you need more specific help, give more specific information about your input fields and expected output fields.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Aug 30, 2008 10:15 pm
Reply with quote

Why do you think you need to change these fields?
Back to top
View user's profile Send private message
NB Gautam

New User


Joined: 29 Aug 2008
Posts: 8
Location: bhubaneswar

PostPosted: Sat Aug 30, 2008 11:03 pm
Reply with quote

Hi Crag,
Actually i am using FILEAID to see the data of a file. But since there are some fields which are in COMP-3 format so i am unable the content properly. so i wanted to convert them in display format.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sat Aug 30, 2008 11:29 pm
Reply with quote

Hello,

To be able to "see" the data, use HEX ON.

It will save copying the file to merely reformat some field(s).
Back to top
View user's profile Send private message
NB Gautam

New User


Joined: 29 Aug 2008
Posts: 8
Location: bhubaneswar

PostPosted: Sun Aug 31, 2008 11:03 pm
Reply with quote

Hi dick,
Thanks . I will use 'hex on' for seeing reformated data. Can i save reformated whole data as a different dataset so that i can downoad that new content from mainfraeme server to local PC.
Back to top
View user's profile Send private message
NB Gautam

New User


Joined: 29 Aug 2008
Posts: 8
Location: bhubaneswar

PostPosted: Sun Aug 31, 2008 11:55 pm
Reply with quote

Hi frank,
Thanks for sending link. I read the document specified in Link.

Suppose there is one variable defined as
WS-VAR1 PIC 9(11) COMP-3

So what will be JCL statement syntax to convert them in DISPLAY format.
I want it in more detail.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Sep 01, 2008 4:52 am
Reply with quote

Hello,

Now that we understand what you really need to do, yes, you need to convert the data.

I believe zoned decimal will not work for you as the pc will not handle the "zone". . .

You need to reformat the data so that a negative is a minus sign rather than a zoned sign.

Look at this previous topic that does the same thing you need to do:
ibmmainframes.com/viewtopic.php?t=31302
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Sep 01, 2008 10:15 pm
Reply with quote

Quote:
Suppose there is one variable defined as
WS-VAR1 PIC 9(11) COMP-3

So what will be JCL statement syntax to convert them in DISPLAY format.


That would be a 6-byte PD field starting at position 1. If you want to convert it to an 11-byte ZD field you could use these DFSORT statements:

Code:

   OPTION COPY
   INREC BUILD=(1,6,PD,TO=ZD,LENGTH=11)


If you want to convert it to a value with blank for a positive sign and - for a negative sign and leading zeros suppressed, you could use these DFSORT statements:

Code:

   OPTION COPY
   INREC BUILD=(1,6,PD,TO=FS,LENGTH=12)



If you want the output in some other form, show what you want it to look like for +1, -1, +12345678901 and -12345678901.
Back to top
View user's profile Send private message
NB Gautam

New User


Joined: 29 Aug 2008
Posts: 8
Location: bhubaneswar

PostPosted: Thu Sep 04, 2008 4:21 pm
Reply with quote

HI All,
Thanks a lot. I got solution for the issue.
Back to top
View user's profile Send private message
krupagk

New User


Joined: 07 Aug 2010
Posts: 13
Location: Hyderabad

PostPosted: Thu Mar 15, 2012 4:36 pm
Reply with quote

Thanks Frank for your solution
Back to top
View user's profile Send private message
ChowHan

New User


Joined: 16 Oct 2009
Posts: 15
Location: India

PostPosted: Fri Mar 16, 2012 10:20 pm
Reply with quote

Err.... you could use the print option in fileaid menu to print this file to a dataset, provided the file does not have occurs depending on or redefines clause... That is ... if this is for a one time use (validation purposes) that way you will get field names as a header as well and you wouldn't have to create a header and this would be easily ported to a spreadsheet . But since you have already decided on a solution so be it...
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts changing defaults in db2 admin - Unlo... DB2 0
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top