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

HOW CAN I CONVERT SIGND packed decimal TO CHAR USE DFSORT?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 8:40 am
Reply with quote

hello,
I want to convert a file'S signed packed decimal column to displayable and ftp this file from mainframe to unix.
the file's format is:
Code:

01 RECORD
   03  COL-1    PIC X(33).
   03  COL-2    S9(9) COMP.
   03  COL-3    PIC X(16).
   03  COL-4    PIC S9(14)V999 COMP.
   03  COL-5    PIC X(70).


I want to convert that file to this format:
Code:

01 RECORD
   03  COL-1    PIC X(33).
   03  COL-2    +9(6).    (this value always less than 999999)
   03  COL-3    PIC X(16).
   03  COL-4    +9(14).999.
   03  COL-5    PIC X(70).

follow the previously message from this forum,I write the JCL as bellow:
Code:

 //SYSIN     DD *
   OPTION COPY
   INREC FIELDS=(1:1,33,
                 34:34,4,PD,TO=FS,LENGTH=6,
                 40:38,16,
                 56:54,8,PD,EDIT=(SIIIIIIIIIIIIIT.TTT),SIGNS=(,-),
                 75:62,70)

but it abend when executed with S0C7 abend code.
the information from JESYSMSG AS bellow:

    IEF237I JES2 ALLOCATED TO SYSIN
    IEA995I SYMPTOM DUMP OUTPUT
    SYSTEM COMPLETION CODE=0C7 REASON CODE=00000000
    TIME=09.10.32 SEQ=20916 CPU=0000 ASID=0031
    PSW AT TIME OF ERROR 078D3000 87DC1C3E ILC 4 INTC 07
    NO ACTIVE MODULE FOUND
    NAME=UNKNOWN
    DATA AT PSW 07DC1C38 - 901744F0 C2C69110 B0024780

the sysout form DFSORT IS:

    ICE084I 0 EXCP ACCESS METHOD USED FOR SORTIN
    ICE751I 2 EF-K10929 F0-K30362 DA-K28804
    ICE185A 0 AN S0C7 ABEND WAS ISSUED BY DFSORT, ANOTHER PROGRAM OR AN EXIT (PHASE C 3)


PLEASE HELP ME PINPOINT why this can abend and how to resolve it,thanks a lot!!
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: Tue Apr 07, 2009 8:46 am
Reply with quote

Hello,

Your cobol definitions have no packed-decimal fields. Col 2 and 4 are definitions of binary numbers rather than packed-decimal numbers.

It may help if you post a few (3 or 4) records using HEX ON.
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 9:49 am
Reply with quote

ok,the recoreds as bellow:
Code:

 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7
 ****** ***************************** Top of Data ****************************
 000001 03208USD03208USD0000832200002021   ]0006080080100004      `-022172903
        FFFFFEECFFFFFEECFFFFFFFFFFFFFFFF400ABFFFFFFFFFFFFFFFFFFFFFF76FFFFFFFFF
        032084240320842400008322000020210001B0006080080100004FFFFFE90022172903
 -----------------------------------------------------------------------------
 000002 03213USD03213USD0000701100000000   ]0006080080200004      f~022172903
        FFFFFEECFFFFFEECFFFFFFFFFFFFFFFF400ABFFFFFFFFFFFFFFFF0000008AFFFFFFFFF
        032134240321342400007011000000000001B000608008020000400000160022172903
 -----------------------------------------------------------------------------
 000003 03213USD03213USD0000809100005007   ]0006081170100004        098263000
        FFFFFEECFFFFFEECFFFFFFFFFFFFFFFF400ABFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFF
        032134240321342400008091000050070001B0006081170100004FFFFFFEE098263000
 -----------------------------------------------------------------------------
 000004 03213USD03213USD0000532000000000   ]0006081170200004        098263000
        FFFFFEECFFFFFEECFFFFFFFFFFFFFFFF400ABFFFFFFFFFFFFFFFF00000002FFFFFFFFF
        032134240321342400005320000000000001B000608117020000400000012098263000
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 9:55 am
Reply with quote

by the way.I am not very clear about what the difference between binary numbers and packed-decimal ,would you please give me some information about it ? thanks a lot!
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Apr 07, 2009 10:12 am
Reply with quote

haohao wrote:
by the way.I am not very clear about what the difference between binary numbers and packed-decimal ,would you please give me some information about it ? thanks a lot!

Refer to the COBOL Language Reference manual for complete descriptions of binary and packed decimal.
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: Tue Apr 07, 2009 10:20 am
Reply with quote

Hello,

Quote:
I am not very clear about what the difference between binary numbers and packed-decimal ,would you please give me some information about it

Here is a link to the cobol manual that describes different numeric data types.
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr40/5.3.12.3.2?

Some editing info is here:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr40/5.3.12.3.3?

This is the link to the Table of Contents for the COBOL Language Reference - a good one to bookmark for regular use.
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IGY3LR40/CONTENTS?

The numbers posted both appear to be binary (comp) rather than packed-decimal (comp-3).

As this file is to be downloaded to unis, i'd suggest you create the file as a tab-delimited file which is quite usable on unix. The tab character is x'05' if my memory hasn't already left the building icon_smile.gif

Good luck - someone will be here if there are questions.
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 10:35 am
Reply with quote

hi DICK:
I have tried with the following JCL:

Code:

//SYSIN     DD *                                                   
     OPTION COPY                                                   
     INREC BUILD=(54,8,BI,EDIT=(SIIIIIIIIIIIIIT.TTT),SIGNS=(+,-,,))


when the value of the variable with s9(13)v9(3) comp format is positive,the conversion is well done,but when it comes with a negative ,the resule is completly wrong.
take a example:
the orginal value is:
Code:

 =COLS> -+----6
 ****** *******
 000001       4
        FFFFFFF
        FFFFFE4
 --------------

it should be a negative number ,but after the convertion ,the result is: +46744073709483.086
it seems to omit the sign of the vlaue when doing the conversion.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Apr 07, 2009 11:22 am
Reply with quote

First off,
Code:
 =COLS> -+----6
 ****** *******
 000001       4
        FFFFFFF
        FFFFFE4
 --------------
is the binary representation of the negative number.
Second, the format 'BI' is unsigned binary, for proper negative usage, you should use 'FI'.
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 11:49 am
Reply with quote

YEAH! your suggestion is perfect right! it works well! thanks everyone comes here !
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 12:36 pm
Reply with quote

I have another question, I want to sort the output file at the same jobsetp,but it seems not functional:
Code:

//SYSIN     DD *                                                     
     OPTION COPY                                                     
     INREC FIELDS=(1:1,33,                                           
                   34:34,4,PD,TO=FS,LENGTH=6,                       
                   40:38,16,                                         
                   56:54,8,FI,EDIT=(SIIIIIIIIIIIIIT.TTT),SIGNS=(,-),
                   75:62,70)                                         
     SORT FIELDS=(40,9,CH,A)                                         


the output file not sorted by the fileds from 40-48.Can I do the convertion and the sortting within one sort step?
Back to top
View user's profile Send private message
vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Tue Apr 07, 2009 12:54 pm
Reply with quote

Try changing INREC to OUTREC

Regards,.
Ram.
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 1:12 pm
Reply with quote

LIKE THAT?
Code:

//SYSIN     DD *                                                   
     OPTION COPY                                                   
     OUTREC FIELDS=(1:1,33,                                         
                   34:34,4,PD,TO=FS,LENGTH=6,                       
                   40:38,16,                                       
                   56:54,8,FI,EDIT=(SIIIIIIIIIIIIIT.TTT),SIGNS=(,-),
                   75:62,70)                                       
     SORT FIELDS=(40,9,CH,A)                                       

IT doesn't work neither.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Apr 07, 2009 1:15 pm
Reply with quote

Either COPY or SORT, not both......
Back to top
View user's profile Send private message
vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Tue Apr 07, 2009 1:19 pm
Reply with quote

Remove the line 'OPTION COPY'
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 1:23 pm
Reply with quote

SO MUST I DO this in two separate SORT job step?
the original file is extraordinary big ,it may contains thirty million records.so I want do this job in one step to reduce the batch window.
Back to top
View user's profile Send private message
vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Tue Apr 07, 2009 1:26 pm
Reply with quote

Please try this and let us know your output:

Code:
//SYSIN     DD *                                                               
     OUTREC FIELDS=(1:1,33,                                         
                   34:34,4,PD,TO=FS,LENGTH=6,                       
                   40:38,16,                                       
                   56:54,8,FI,EDIT=(SIIIIIIIIIIIIIT.TTT),SIGNS=(,-),
                   75:62,70)                                       
     SORT FIELDS=(40,9,CH,A)
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 1:29 pm
Reply with quote

ok,it works! thanks everybody here !
SORT is magical!
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 1:31 pm
Reply with quote

the result as bellow:
Code:

000001 832200002021  414030006080080100004           -100.000022172903208014832
000002 701100000000  414030006080080200004            100.000022172903208014832
000003 809100005007  414030006081170100004             -0.290098263000001000000
000004 809100005007  414030006081170100004           -300.000001055000001000000
000005 809100005007  414030006081170100004             -2.700098271000001000000
000006 809100005007  414030006081170100004            -14.640098248000001000000
000007 832200002021  414030006081170100004            300.000020045903208014832
000008 530500000000  414030006081170200004             14.640098248000001000000
000009 530200000000  414030006081170200004              2.700098271000001000000
000010 532000000000  414030006081170200004              0.290098263000001000000
000011 834100002025  414030006081320100004             10.000020010903208001834
000012 701100000000  414030006081320200004            -10.000020010903208001834
000013 834100002025  414030006081370100004             10.000020010903208001834
000014 701100000000  414030006081370200004            -10.000020010903208001834
000015 834100002025  414030006081480100004             10.000020010903208001834
000016 701100000000  414030006081480200004            -10.000020010903208001834
000017 834100002025  414030006082420100004             10.000020010903208001834
000018 701100000000  414030006082420200004            -10.000020010903208001834

thanks a lot!!
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Tue Apr 07, 2009 6:30 pm
Reply with quote

some problem again here:
if I want insert some separate sign between colums,like that:
Code:

//SYSIN     DD *                                                     
     OUTREC FIELDS=(1:1,5,C'|',                                       
                 7:6,3,C'|',                                         
                11:9,25,C'|',                                         
                37:34,4,FI,EDIT=(TTTTTT),C'|',                       
                44:38,9,C'|',                                         
                54:47,2,C'|',                                         
                57:49,5,C'|',                                         
                63:54,8,FI,EDIT=(SIIIIIIIIIIIIIT.TTT),SIGNS=(,-),C'|',
                83:62,6,C'|',                                         
                90:68,16,C'|',                                       
               107:84,1,C'|',                                         
               109:85,9,C'|',                                         
               119:94,24,C'|',                                       
               144:118,3,C'|',                                       
               148:121,1,C'|',                                       
               150:122,7,C'|',                                       
               158:129,1,C'|',                                       
               160:130,2,C'|')                                       
     SORT FIELDS=(44,9,CH,A)   

the sort doesn't function again. so can I do it with sort?
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: Tue Apr 07, 2009 9:17 pm
Reply with quote

Quote:
the sort doesn't function again


DFSORT "didn't function" because you did something wrong. But you haven't given any information on what "didn't function" means.

Did you get an error message? I so, show the messages you received.

Did you get different output then you expected? If so, show an example of the output you got and the output you expected.

If you mean something else by "didn't function", you need to give more details of what you mean.

By the way, the reason you needed to use OUTREC instead of INREC is because INREC is processed before SORT whereas OUTREC is processed after SORT. So with INREC, you changed the positions before you sorted and would need to use those reformatted positions for the SORT statement, whereas with OUTREC you changed the positions after SORT so you can use the input positions for the SORT statement.
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Wed Apr 08, 2009 6:31 am
Reply with quote

yeah,after I change to use the input positions for the SORT statement,it can work normally.
I am new to SORT,so there are to many concept is ambiguous to me.thanks everybody here give me those valuable information to solve my difficulty! icon_biggrin.gif
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: Wed Apr 08, 2009 7:58 pm
Reply with quote

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:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Thu Apr 09, 2009 7:04 am
Reply with quote

thank you very much! It's very helpful!
Back to top
View user's profile Send private message
Satyendra Tripathi

New User


Joined: 06 Oct 2021
Posts: 1
Location: India

PostPosted: Thu Sep 29, 2022 1:19 pm
Reply with quote

CICS Guy wrote:
First off,
Code:
 =COLS> -+----6
 ****** *******
 000001       4
        FFFFFFF
        FFFFFE4
 --------------
is the binary representation of the negative number.
Second, the format 'BI' is unsigned binary, for proper negative usage, you should use 'FI'.


Hi,

I am facing same sign issue but my Data type is PD(Packed decimal). I am getting all the values as positive even negative values are also changed to Positive. Could any of you please help!
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Thu Sep 29, 2022 6:47 pm
Reply with quote

haohao wrote:
thank you very much! It's very helpful!


It would be nice if you tried to UNDERSTAND at least some of the advices given to you at this forum.

Based on you posts, and used terminology, I guess that you only copy-and-paste the given solutions without a minor understanding what does this mean?

Sometimes you respond with "thank you very much! It's very helpful!". That's it.

* * * * *

Your posts like this
Quote:
the sort doesn't function again. so can I do it with sort?
are extremely senseless.

* * * * *

Quote:
follow the previously message from this forum,I write the JCL as bellow:

Code:
//SYSIN     DD *
   OPTION COPY
   INREC FIELDS=(1:1,33,
                 34:34,4,PD,TO=FS,LENGTH=6,
                 40:38,16,
                 56:54,8,PD,EDIT=(SIIIIIIIIIIIIIT.TTT),SIGNS=(,-),
                 75:62,70)


SORT control statements are NOT JCL, in any manner!!!!!!!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top