View previous topic :: View next topic
Author
Message
murugan_mf Active User Joined: 31 Jan 2008Posts: 148 Location: Chennai, India
Hi,
I am sorting a file based on two key fields and also removing the duplicates.
Code:
SORT FIELDS=(1,4,ZD,A,67,9,ZD,A)
SUM FIELDS=NONE
OUTREC BUILD=(1,4,X'6B',6:67,9).
The output file should contains the key fields sorted and seperated by comma.
The result of sort was
Code:
0006,00000008{
0007,00000011{
0009,00000012{
The cobol equivalent datatype for the key fields in the input file is
key field1 -- PIC 9(4)
key field2 -- PIC S9(9)
I guess '{' represents the sign bit. Is there any possible way of representing it with '+' or '-' sign.
Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
murugan_mf,
Change your OUTREC statement as below.
Code:
OUTREC BUILD=(1,4,X'6B',67,9,ZD,EDIT=(STTTTTTTTT),SIGNS=(+,-,,))
Back to top
Anuj Dhawan Superior Member Joined: 22 Apr 2006Posts: 6250 Location: Mumbai, India
Hi,
murugan_mf wrote:
I guess '{' represents the sign bit. Is there any possible way of representing it with '+' or '-' sign.
Yes that's true:
e.g:
Code:
NUMBER REPRESENTATION
10 00000001{
105 00000010E
0 00000000{
-234 00000023M
-30 00000003}
Back to top
murugan_mf Active User Joined: 31 Jan 2008Posts: 148 Location: Chennai, India
Arun,
I changed the OUTREC statement as you said its working fine.
I need a clarification
Code:
EDIT=(STTTTTTTTT),SIGNS=(+,-,,)
+ & - are the signs and again you have used a comma in SIGNS=(+,-,,).
I executed by giving SIGNS=(+,-). It works fine.
What is the difference in adding an extra comma.
Back to top
skkp2006 New User Joined: 14 Jul 2006Posts: 93 Location: Chennai,India
Murugan,
The following is a table identifying the zoned decimal hex characters.
Code:
Last -----Character (Hex Code)-----
Digit Unsigned Positive Negative
----- -------- -------- --------
0 "0" (F0) "{" (C0) "}" (D0)
1 "1" (F1) "A" (C1) "J" (D1)
2 "2" (F2) "B" (C2) "K" (D2)
3 "3" (F3) "C" (C3) "L" (D3)
4 "4" (F4) "D" (C4) "M" (D4)
5 "5" (F5) "E" (C5) "N" (D5)
6 "6" (F6) "F" (C6) "O" (D6)
7 "7" (F7) "G" (C7) "P" (D7)
8 "8" (F8) "H" (C8) "Q" (D8)
9 "9" (F9) "I" (C9) "R" (D9)
and again a more detailed one at simotime
Syam
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
murugan_mf wrote:
What is the difference in adding an extra comma.
The syntax of SIGNS sub parameter is as shown below.
SIGNS=(s1,s2,s3,s4)
s1= leading positive sign indicator
s2= leading negative sign indicator
s3= trailing positive sign indicator
s4= trailing negative sign indicator
There's no difference between the two forms in your case since you need a leading sign byte(+/-). But if you needed trailing signs, you should provide the commas like this as the values are positonal.
Code:
ZD,EDIT=(TTTTTTTTTS),SIGNS=(,,+,-))
Back to top
murugan_mf Active User Joined: 31 Jan 2008Posts: 148 Location: Chennai, India
Arun,
Thanks!
Back to top
Please enable JavaScript!