|
View previous topic :: View next topic
|
| Author |
Message |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
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 |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
| 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 |
|
 |
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
| 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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
| Back to top |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
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 |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
| YEAH! your suggestion is perfect right! it works well! thanks everyone comes here ! |
|
| Back to top |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
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 |
|
 |
vinothsubramanian
New User
Joined: 01 Sep 2006 Posts: 39 Location: Chennai, India
|
|
|
|
Try changing INREC to OUTREC
Regards,.
Ram. |
|
| Back to top |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
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 |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| Either COPY or SORT, not both...... |
|
| Back to top |
|
 |
vinothsubramanian
New User
Joined: 01 Sep 2006 Posts: 39 Location: Chennai, India
|
|
|
|
| Remove the line 'OPTION COPY' |
|
| Back to top |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
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 |
|
 |
vinothsubramanian
New User
Joined: 01 Sep 2006 Posts: 39 Location: Chennai, India
|
|
|
|
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 |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
ok,it works! thanks everybody here !
SORT is magical! |
|
| Back to top |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
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 |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| 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 |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
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!  |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
| thank you very much! It's very helpful! |
|
| Back to top |
|
 |
Satyendra Tripathi
New User
Joined: 06 Oct 2021 Posts: 1 Location: India
|
|
|
|
| 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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|