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
 

 

Syncsort - Mulitiply problem in sort
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort - Mulitiply problem in sort
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jul 29, 2011 7:28 pm    Post subject:
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    Post subject: Reply to: Mulitiply problem in sort
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: 578
Location: USA

PostPosted: Fri Jul 29, 2011 7:30 pm    Post subject:
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    Post subject:
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: 578
Location: USA

PostPosted: Fri Jul 29, 2011 7:43 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jul 29, 2011 8:19 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jul 29, 2011 8:24 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jul 29, 2011 8:36 pm    Post subject:
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: 578
Location: USA

PostPosted: Fri Jul 29, 2011 8:53 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jul 29, 2011 9:37 pm    Post subject: Reply to: Syncsort - Mulitiply problem in sort
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: 578
Location: USA

PostPosted: Fri Jul 29, 2011 9:46 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jul 29, 2011 10:11 pm    Post subject:
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

Site Director


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

PostPosted: Sat Jul 30, 2011 12:06 am    Post subject: Reply to: Syncsort - Mulitiply problem in sort
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 Moderator


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

PostPosted: Sat Jul 30, 2011 1:11 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Sat Jul 30, 2011 2:16 am    Post subject: Reply to: Syncsort - Mulitiply problem in sort
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM 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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
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 Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am


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