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

Syncsort - Mulitiply problem in sort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Fri Jul 29, 2011 7:16 pm
Reply with quote

Hi,
Code:

  SORT FIELDS=COPY                         
  OUTREC IFTHEN=(WHEN=(1506,1,CH,EQ,C'1'),
     OVERLAY=(1589:1586,3,FS,MUL,+100000))
.

I am not getting correct result with the above code ,i am just multipling the value on 1586 an putting in 1589 I am not sure why i am i am getting 0 in the output.Is FS correct in that postions.

Eg:if 1586,3 has 123 then 1589 should have 12300000

Please someone advise me on this.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 29, 2011 7:28 pm
Reply with quote

Have you wondered how the software knows how long you want your new field to be? When you say you are getting 0, how many are you getting?
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Fri Jul 29, 2011 7:29 pm
Reply with quote

Oh..should i need to use length in that case ?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Jul 29, 2011 7:30 pm
Reply with quote

paduchuri,
Please provide your input data(preferably Hex as well) and the output you getting when you run above sort?

Thanks,
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Fri Jul 29, 2011 7:35 pm
Reply with quote

sqlcode1 wrote:
paduchuri,
Please provide your input data(preferably Hex as well) and the output you getting when you run above sort?

Thanks,


please see input and output below

Input(number) output
123 0
456 0
222 0

I tried using length keyword still not working...

Is the datatype i am using not correct
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Jul 29, 2011 7:43 pm
Reply with quote

paduchuri,
Check the test JCL below and output I get when I run the same job.

Also I don't know what is your input data type but it works with FS. If you could provide Cobol declaration, I might be able to tell you if the FS is correct or not.

Read about DFSort Data types here

Code:
//STEP0001 EXEC PGM=SORT                               
//SORTIN   DD  *                                       
123                                                     
456                                                     
222                                                     
//SORTOUT  DD  SYSOUT=*                                 
//SYSIN    DD  *                                       
  OPTION COPY                                           
  OUTREC OVERLAY=(5:1,3,FS,MUL,+100000,TO=FS,LENGTH=8) 
/*                                                     
//SYSOUT   DD  SYSOUT=*                                 
//SYSUDUMP DD  SYSOUT=D                                 
//*                                                     

OUTPUT
Code:
123 12300000
456 45600000
222 22200000

Thanks,
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Fri Jul 29, 2011 8:16 pm
Reply with quote

sqlcode1 wrote:
paduchuri,
Check the test JCL below and output I get when I run the same job.

Also I don't know what is your input data type but it works with FS. If you could provide Cobol declaration, I might be able to tell you if the FS is correct or not.

Read about DFSort Data types here

Code:
//STEP0001 EXEC PGM=SORT                               
//SORTIN   DD  *                                       
123                                                     
456                                                     
222                                                     
//SORTOUT  DD  SYSOUT=*                                 
//SYSIN    DD  *                                       
  OPTION COPY                                           
  OUTREC OVERLAY=(5:1,3,FS,MUL,+100000,TO=FS,LENGTH=8) 
/*                                                     
//SYSOUT   DD  SYSOUT=*                                 
//SYSUDUMP DD  SYSOUT=D                                 
//*                                                     

OUTPUT
Code:
123 12300000
456 45600000
222 22200000

Thanks,


Hi,

Thanks for the reply you code works fine except the if has 0 at starting like below


Code:


023 +2300000   <== here
456 45600000


I dont want the '+' sighn in the output

Please also could you tell me the reason TO=FS what is the default datatype ?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 29, 2011 8:19 pm
Reply with quote

Change the FS to ZD. Both of them, unless you have a sign in your original field.
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Fri Jul 29, 2011 8:23 pm
Reply with quote

Bill Woodger wrote:
Change the FS to ZD. Both of them, unless you have a sign in your original field.


Code:

SYSIN :                                               
  OPTION COPY                                         
  OUTREC OVERLAY=(5:1,3,ZD,MUL,100000,TO=ZD,LENGTH=8)
                               *                     
WER271A  OUTREC STATEMENT  : NUMERIC FIELD ERROR     
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000         
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE         


I got an error if i change to ZD
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 29, 2011 8:24 pm
Reply with quote

Of course, there is another way to do it as well. Copy the original field, and then a new field filled with five zeros.
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Fri Jul 29, 2011 8:26 pm
Reply with quote

Bill Woodger wrote:
Of course, there is another way to do it as well. Copy the original field, and then a new field filled with five zeros.


Could you please post the code if possible.Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 29, 2011 8:36 pm
Reply with quote

paduchuri wrote:
Bill Woodger wrote:
Change the FS to ZD. Both of them, unless you have a sign in your original field.


Code:

SYSIN :                                               
  OPTION COPY                                         
  OUTREC OVERLAY=(5:1,3,ZD,MUL,100000,TO=ZD,LENGTH=8)
                               *                     
WER271A  OUTREC STATEMENT  : NUMERIC FIELD ERROR     
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000         
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE         


I got an error if i change to ZD



Mmmm... I didn't say anything about chopping the + off the multiplicand.

My other suggestion was without awareness of this problem, which I think will be solved by putting the + back on.

Edit: And, of course, WER = SYNCSORT - off to the JCL forum...
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Jul 29, 2011 8:53 pm
Reply with quote

paduchuri,
You are using Syncsort, so everything below is a guess since I have DFSort.

FS is optional sign. When I run the same job with 023 as input, I get 2300000. Not sure why you are getting + sign in the output. Does your input data have sign that you are not showing here?

I am not sure SFF/UFF is supported in Syncsort but If you do have leading sign,I would use SFF and convert to ZD. Something like below.

Code:
OUTREC OVERLAY=(6:1,3,SFF,MUL,+100000,M11,LENGTH=8)

If you don't want leading zeros then use below.
Code:
OUTREC OVERLAY=(6:1,3,SFF,MUL,+100000,M10,LENGTH=8)


Quote:
Please also could you tell me the reason TO=FS what is the default datatype ?
I don't have Syncsort manual or else I would point you to the link but TO=FS, would make sure that after the arithmetic operation resultant field is kept in FS(or you could convert other data types as well).

Thanks,
Back to top
View user's profile Send private message
paduchuri

New User


Joined: 03 Jan 2011
Posts: 32
Location: Hyderabad

PostPosted: Fri Jul 29, 2011 9:24 pm
Reply with quote

Perfect bro,

Your guess is super.I got what i want

Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 29, 2011 9:37 pm
Reply with quote

Code:
OUTREC OVERLAY=(5:1,3,CH,5C'0')


Would be my "guess" as an option for the other solution. Don't think you need the CH, you could probably leave it out (try) and, if you want, maket it ZD, FS, SFF or your choice.

Can't test it myself, but give it a whack if you feel up to it.

Try it on SYMNAMES as well:

Code:
FIVEZEROSTOAPPEND 5C'0'

and

OUTREC OVERLAY=(5:1,3,FIVEZEROSTOAPPEND)


Note, I've dropped the CH here, just so you do get to try it.

Have a good weekend!
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Jul 29, 2011 9:46 pm
Reply with quote

Bill Woodger,

OUTREC OVERLAY=(5:1,3,CH,5C'0')

What if I have +12, output will be +1200000. OP didn't wanted "sign".

Thanks,
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 29, 2011 10:11 pm
Reply with quote

Well, that would be true. Thanks.

However, from his sample data, for his three-digit field, I'm extrapolating that he doesn't, and thinking he just stumbled sumwhat onto the FS for his field definition. Really, with a three-digit field and two- or three-digit examples, I don't think there is room for a sign.

What I'm trying to show is the alternative to the "multiply by a factor of 10", which is to stick an appropriate number of zeros on the end of the new field. If he does have the +/-, then it is the other part of the code that I was so unconcerned about, that would need to change.

How he got a sign with your code is an interesting question. I was thinking (guessing, no Syncsort manual, blah, blah) that maybe Syncsort includes a sign by default when going to an FS field (if there is room for it, anyway) and DFSORT does not.

Sorry for only guessing, Frank and Kolusu. Not much use.
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 Jul 30, 2011 12:06 am
Reply with quote

Hi Bill,

Quote:
Sorry for only guessing, Frank and Kolusu. Not much use.
As this is a Syncsort topic, i suspect Frank and Kolusu will be somewhat scarce icon_smile.gif

d
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: Sat Jul 30, 2011 1:11 am
Reply with quote

If there's a question somewhere in here about DFSORT, I'd be happy to answer it. Somebody just has to "spell it out" for me so I know what the question is.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jul 30, 2011 2:16 am
Reply with quote

Dick, I forgot it had moved :-)

Frank, it was one of those things that started off as a DFSORT question. The WER messages arrived after sqlcode1 had provided a solution. The solution produced a different result between DFSORT and what turned out to be the same code under Syncsort.

TS had started with a data-type of FS while trying to add five trailing zeros to a three-digit field. Along with the multiply, the output was converted TO=FS.

With a 023 test case, multiplied by +100000 and TO=FS, DFSORT for sqlcode1 came up with 02300000. TS, using Syncsort, got +2300000.

At which point I speculated that Syncsort could be putting the + in, if there was space, wheras DFSORT not.

I'm still not sure it is a real question, sorry.
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: Sat Jul 30, 2011 2:38 am
Reply with quote

From the DFSORT APG description of TO=FS:

Quote:
For FS output, blank is used as the positive sign, - is used as the negative sign and leading zeros are suppressed.


If you want a + sign, you can use EDIT=(SII...IT),SIGNS=(+,-)

Quote:
DFSORT for sqlcode1 came up with 02300000


That doesn't make sense. DFSORT would have a leading blank, not a leading zero. For example, with:

Code:

...
//SORTIN DD *                                           
023     
123                                                 
//SORTOUT DD SYSOUT=*                                   
//SYSIN DD *                                             
  OPTION COPY                                           
  INREC BUILD=(1,3,ZD,MUL,+100000,TO=FS,LENGTH=9)       


SORTOUT has:

Code:

  2300000     
 12300000     


With

Code:

  INREC BUILD=(1,3,ZD,MUL,+100000,EDIT=(SIIIIIIIT),SIGNS=(+,-))


SORTOUT has:

Code:

 +2300000
+12300000
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Sat Jul 30, 2011 3:06 am
Reply with quote

Bill Woodger wrote:
Dick, I forgot it had moved :-)
With a 023 test case, multiplied by +100000 and TO=FS, DFSORT for sqlcode1 came up with 02300000. TS, using Syncsort, got +2300000.

huh? When?

We shouldn't be discussing this but the fact that OP got leading sign is/was because OP failed to provide us with correct test data. He would have leading sign originally in his file. That's why the job with SFF worked for him.

Thanks,
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jul 30, 2011 4:04 am
Reply with quote

Frank Yaeger wrote:
[...]
Quote:
DFSORT for sqlcode1 came up with 02300000


That doesn't make sense. DFSORT would have a leading blank, not a leading zero. [...]



Yes, sorry about that Frank, sorry sqlcode1. It did come up with a leading blank in sqlcode1's run. TS/OP claims a different result for the other product. End of story.

Thanks for the explanation as well.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top