Page 1 of 1

Character to Packed Decimal coversion usinG sort

PostPosted: Thu Aug 12, 2010 8:29 pm
by djprakash1ml
How to convert PIC X(16) variable to PD?

Re: Character to Packed Decimal coversion usinG sort

PostPosted: Thu Aug 12, 2010 10:55 pm
by Frank Yaeger
Since you haven't given any real details about what your PIC X(16) numbers look like, I'll just assume they are ZD values. In that case, you would use DFSORT control statements something like this where p is the starting position of the field:

    OPTION COPY
    INREC BUILD=(p,16,ZD,TO=PD)


If you need more specific help, give more details including an example of the your input records and what you expect for output, the starting position, length and format of the input fields, the RECFM and LRECL of the input file, etc.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080

Re: Character to Packed Decimal coversion usinG sort

PostPosted: Fri Aug 13, 2010 1:45 pm
by djprakash1ml
Thanks Frank for the response. Will go through the tutorial for more details.

Re: Character to Packed Decimal coversion usinG sort

PostPosted: Fri Jun 20, 2014 11:21 am
by mainframe_babu
Hi ,

could you please provide a solution for the following requirment(either in cobol programing or in JCl),

where i have input file as below format

0012500000 --- char(10)
0123450000 --- char(10)

and i need the o/p file records as below format.

001.2500000 --- s9(3)v((7) comp-3
012.3450000 --- s9(3)v((7) comp-3

Re: Character to Packed Decimal coversion usinG sort

PostPosted: Fri Jun 20, 2014 11:35 am
by BillyBoyo
Can't you just apply Frank's solution to your problem?

Re: Character to Packed Decimal coversion usinG sort

PostPosted: Fri Jun 20, 2014 2:31 pm
by NicC
A) Do not tailgate old topics
B) It cannot be done using JCL - JCL does not manipulate data. It only tells the OS what programs you want to run and what resources/input/output they need
C) If you want a COBOL solution why not post in the COBOL part of the forum.

Re: Character to Packed Decimal coversion usinG sort

PostPosted: Mon Jun 23, 2014 11:09 am
by mainframe_babu
Thanks Billyboyo and NicC for the replay.

Sorry NicC for posting this in jcl form and i supposed to ask in sort step of a Jcl.(and whether is it possible in cobol?)

My questions is here , in sort where it will assume the decimal point as the below sort.

OPTION COPY
INREC BUILD=(p,16,ZD,TO=PD)

Re: Character to Packed Decimal coversion usinG sort

PostPosted: Mon Jun 23, 2014 11:27 am
by BillyBoyo
SORT makes no assumptions about decimal places. There are no implied decimal places in SORT. If calculating with decimal places in SORT, for instance, you have to do your own rearrangement if necessary.

If just moving stuff around, with a BUILD or an OVERLAY, it doesn't matter anyway. It is only when you specifically want to/need to take decimal places into account that you have to do anything.

Re: Character to Packed Decimal coversion usinG sort

PostPosted: Mon Jun 23, 2014 12:05 pm
by mainframe_babu
Thanks Billyboyo.