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
 

 

HOW CAN I CONVERT SIGND packed decimal TO CHAR USE DFSORT?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: HOW CAN I CONVERT SIGND packed decimal TO CHAR USE DFSORT?
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

Site Director


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

PostPosted: Tue Apr 07, 2009 8:46 am    Post subject:
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    Post subject:
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    Post subject:
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: 1238
Location: Richfield, MN, USA

PostPosted: Tue Apr 07, 2009 10:12 am    Post subject:
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

Site Director


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

PostPosted: Tue Apr 07, 2009 10:20 am    Post subject:
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.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr40/5.3.12.3.2?

Some editing info is here:
http://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.
http://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    Post subject: Reply to: HOW CAN I CONVERT SIGND packed decimal TO CHAR USE
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: 2150
Location: At my coffee table

PostPosted: Tue Apr 07, 2009 11:22 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Tue Apr 07, 2009 1:15 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Apr 07, 2009 9:17 pm    Post subject:
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts convert PD to ZD ram_vizag DFSORT/ICETOOL 5 Sat Nov 05, 2016 3:06 am
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am


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