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

JCL sort-How to reject the Sign?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lokeshwar_manoharan

New User


Joined: 22 Sep 2008
Posts: 49
Location: Chennai,Tamilnadu

PostPosted: Mon Oct 06, 2008 9:57 pm
Reply with quote

Hi,

When I convert S9(9) variable using sort step using

(1,4,BI,M11) it is converting to 09(9)

ie eg -111111111 is converted to 0111111111

Is there any method to reject the sign and have only 9 character

111111111 ?

Thanks,
Lokesh
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: Mon Oct 06, 2008 10:35 pm
Reply with quote

Wow, could your post have been any more confusing if you tried?

S9(9) is a ZD format field, so why are you using BI instead of ZD?

What do you mean by "reject the sign"? Do you want to use the absolute value (e.g. -1 -> 1?).

I can't make heads or tails of what you want to do.

Show an example of your input values (in hex) and what you expect the output values to look like. Indicate the correct format for the input values (BI? ZD?).
Back to top
View user's profile Send private message
lokeshwar_manoharan

New User


Joined: 22 Sep 2008
Posts: 49
Location: Chennai,Tamilnadu

PostPosted: Tue Oct 07, 2008 10:48 am
Reply with quote

No its not hexa value, it is S9(9) comp. Binary value

Yes -1 should be converted to 1 with one byte and not 2 bytes

I know we can get the values by having one more sort step. But is there

any way without using another sort step ?

Regards,
Lokeshwar
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Tue Oct 07, 2008 2:55 pm
Reply with quote

lokeshwar_manoharan wrote:


No its not hexa value, it is S9(9) comp. Binary value



Go to your dataset where you have this S9(9) in ISPF view mode. Type Command HEX on. Then your data looks something like below.

Code:

000001     TESTING                                 
       0240ECEECDC444444444444444444444444444444444
       15003523957000000000000000000000000000000000


Post your data in this format.

But by the looks of it You have data in BI format and you don't want to change data type. Instead you want to change all negative data to positive.

Am i correct.
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 Oct 07, 2008 8:49 pm
Reply with quote

Lokeshwar,

You still haven't made it clear what you want to do or shown an example of input and expected output values.

S9(9) COMP is a 4-byte FI field. If you want to get the absolute value of the field, you can multiply it by -1. If you want the output value to be 4-byte BI (no sign), you can use these DFSORT statements:

Code:

  OPTION COPY                                     
  INREC OVERLAY=(1,4,FI,MUL,-1,TO=BI,LENGTH=4)     


If you want the output value to be something else (ZD? another form?), you have to say exactly what you want it to look like. Again, examples of input values and expected output values would help.
Back to top
View user's profile Send private message
lokeshwar_manoharan

New User


Joined: 22 Sep 2008
Posts: 49
Location: Chennai,Tamilnadu

PostPosted: Fri Oct 10, 2008 1:06 am
Reply with quote

Input:

First 4 Bytes -> S9(9) COMP

5th Byte -> X(1)

Last two Bytes -> S9(4) COMP

É8J1
07FDF00
8181101
--------
É8J1
07FDF00
8181102
--------
É8J1
07FDF00
8181103


By using the sort ,


//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=1,
OUTREC=(1,4,BI,M11,5,1,6,2,BI,M11)
//*


I am getting as output(16 Bytes)

0141686993100001
0141686993100002
0141686993100003


Here zeroes are added in the place of Sign (See 1st and 12th position)

Instead of this I need to get as output (14 Bytes)

14168699310001
14168699310002
14168699310003


I know it is possible by having one more sort step by selecting appropriate
fields,

I want to know is there any mask pattern or any way to change as such without extra sort step
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: Fri Oct 10, 2008 3:54 am
Reply with quote

Quote:
Here zeroes are added in the place of Sign (See 1st and 12th position)


No, that's not why you have the leading zeros. You have them because you didn't specify a length for the M11 mask, so the default length is used.
If you want a specific length for the M11 masks, you have to specify that length. Now that you've finally described what you want clearly, I can show you how to get it:

Code:

  SORT FIELDS=COPY                                     
  OUTFIL FILES=1,                                       
   OUTREC=(1,4,BI,M11,LENGTH=9,5,1,6,2,BI,M11,LENGTH=4)
Back to top
View user's profile Send private message
lokeshwar_manoharan

New User


Joined: 22 Sep 2008
Posts: 49
Location: Chennai,Tamilnadu

PostPosted: Fri Oct 10, 2008 3:40 pm
Reply with quote

Thanks a lot Frank!!

Its working now!!!
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: Fri Oct 10, 2008 8:46 pm
Reply with quote

Good. Next time it would be better if you just post what you're trying to do with an example of the input and output. Your assumption that the sign was the problem was a red-herring and just increased the number of posts needed to give you the solution.
Back to top
View user's profile Send private message
lokeshwar_manoharan

New User


Joined: 22 Sep 2008
Posts: 49
Location: Chennai,Tamilnadu

PostPosted: Sat Oct 11, 2008 10:36 pm
Reply with quote

Frank,

There is another problem
My input file:

First 4 Bytes: S9(9) comp
Fifth Byte: X(1)
6th - 8th Byte: X(3)(Packed decimal format)

Code:
 tù_1   
0AD6F000
63DD1800
--------
 tù_1   
0AD6F200
63DD1000
--------
 tù_1   
0AD6F000
63DD1800


Sort step:

Code:
//SORTOF1  DD DSN=OUTPUT,       
//            DISP=(MOD,CATLG,DELETE),         
//            DCB=(*.SORTIN),                   
//           SPACE=(CYL,(10,10),RLSE)           
//SYSIN DD *                                   
     SORT FIELDS=COPY                           
    OUTFIL FILES=1,                             
    OUTREC=(1,4,BI,M11,LENGTH=9,5,1,6,3,PD,M11)
/*

This step resulting in S0C7 abend. What could be the reason?

But when I have X(3) (Packed decimal) as first element and when I give

Code:
//SORTOF1  DD DSN=OUTPUT,       
//            DISP=(MOD,CATLG,DELETE),         
//            DCB=(*.SORTIN),                   
//           SPACE=(CYL,(10,10),RLSE)           
//SYSIN DD *                                   
     SORT FIELDS=COPY                           
    OUTFIL FILES=1,                             
    OUTREC=(1,3,PD,M11)
/*                     

Its working. What could be the error in the previous step?
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: Sat Oct 11, 2008 10:52 pm
Reply with quote

Hello,

Bytes 6-8 are not valid packed-decimal numbers. . .

Neither are bytes 1-3 which you have specified in the job you believe is working (it really isn't running correctly - it is simply not abending). The limited data you have posted accidentally has a valid sign, so you do not recieve an 0c7.

Also, please note that your post has been changed to use the "Code" tag which makes the content more readable.
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: Mon Oct 13, 2008 5:30 am
Reply with quote

Lokesh,

As Dick has pointed out, the data you show in positions 6-8 is NOT packed decimal. X'080000' is binary. X'08000C' would be an example of PD.

You really need to figure out what type of data you're dealing with in order to be able to convert it correctly. For details on the different types of data formats DFSORT recognizes, see:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/C.1?DT=20060615185603
Back to top
View user's profile Send private message
lokeshwar_manoharan

New User


Joined: 22 Sep 2008
Posts: 49
Location: Chennai,Tamilnadu

PostPosted: Mon Oct 13, 2008 1:06 pm
Reply with quote

Thanks Dick and Frank

In my input the values are showing correctly on making HEX on

Code:
Ø           
800         
000         
------------
Ø           
800         
000         
------------
Ø           
800         
000         



How to get these values? EG:800000
Do I need to convert to HEX? What is the syntax for conversion?
In the table it is declared as X(3) only
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: Mon Oct 13, 2008 8:33 pm
Reply with quote

If you want to convert X'800000' in positions 1-3 to C'800000', you can use:

Code:

1,3,HEX
Back to top
View user's profile Send private message
lokeshwar_manoharan

New User


Joined: 22 Sep 2008
Posts: 49
Location: Chennai,Tamilnadu

PostPosted: Wed Oct 15, 2008 12:36 pm
Reply with quote

Thanks!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top