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
 

 

Build record according subtraction result

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
witsche

New User


Joined: 04 May 2005
Posts: 3

PostPosted: Fri Oct 02, 2015 12:53 pm    Post subject: Build record according subtraction result
Reply with quote

Hi all,
I have to match two datasets (FB200) and:
 - if the key is present only in the first dataset, I have to write the record in AM28.DOP0GF.TS000.CONTRADI.GFMBF manipulating data
 - if the key is present only in the second dataset, I have to write the record as is in AM28.DOP0GF.TS000.CONTRADI.GFMBF
 - if the key is present on both datasets, I have to subtract dataset2.campoA from dataset1.campoA: if the result is >= 0 I have to write a record in AM28.DOP0GF.TS000.CONTRADI.GFMBF inserting the result of subtracting in a certain position; if the result is < 0 I have to write a record in AM28.DOP0GF.TS000.CONTRADI.GFMBF inserting the subtraction result in a certain position.

This is the step that I wrote:

Code:
//P060     EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//*--- INPUT                                                           
//SORTJNF1 DD DISP=SHR,DSN=AM28.DOP0GF.TS000.CONTRADI.GFMBF.OUT20A     
//SORTJNF2 DD DISP=SHR,DSN=AM28.DOP0GF.TS000.CONTRADI.GFMBF.OUT20B     
//*--- OUTPUT                                                           
//F12      DD DSN=AM28.DOP0GF.TS000.CONTRADI.GFMBF,                     
//            DISP=MOD                                                 
//F01      DD DSN=AM28.DOP0GF.TS000.CONTRADI.GFMBF,                     
//            DISP=MOD                                                 
//F02      DD DSN=AM28.DOP0GF.TS000.CONTRADI.GFMBF,                     
//            DISP=MOD                                                 
//*                                                                     
//SYSIN    DD *                                                         
 JOINKEYS FILE=F1,FIELDS=(65,17,CH,A)                                   
 JOINKEYS FILE=F2,FIELDS=(65,17,CH,A)                                   
 JOIN UNPAIRED,F1,F2                                                   
 REFORMAT FIELDS=(F1:01,200,F2:01,200,?)                               
 SORT FIELDS=COPY                                                       
 OUTFIL   FNAMES=F01,INCLUDE=(401,1,CH,EQ,C'1'),                       
          BUILD=(1,145,164,18,C'000000000000000000',182,19)             
 OUTFIL   FNAMES=F02,INCLUDE=(401,1,CH,EQ,C'2'),                       
          BUILD=(201,200)                                               
 OUTFIL   FNAMES=F12,INCLUDE=(401,1,CH,EQ,C'B'),                       
          IFTHEN(WHEN=((164,18,ZD,SUB,364,18,ZD),GE,0),                 
                BUILD=(1,145,164,18,(164,18,ZD,SUB,364,18,ZD),         
                       C'000000000000000000',182,19)),                 
          IFTHEN(WHEN=NONE,                                             
                BUILD=(1,145,164,18,C'000000000000000000',             
                      (164,18,ZD,SUB,364,18,ZD),182,19))               
                                                                       
/*                                                                     

and I get this error:

Code:
  OUTFIL   FNAMES=F12,INCLUDE=(401,1,CH,EQ,C'B'),                               
           IFTHEN(WHEN=((164,18,ZD,SUB,364,18,ZD),GE,0),                       
                                   *                                           
                 BUILD=(1,145,164,18,(164,18,ZD,SUB,364,18,ZD),                 
                        C'000000000000000000',182,19)),                         
           IFTHEN(WHEN=NONE,                                                   
                 BUILD=(1,145,164,18,C'000000000000000000',                     
                       (164,18,ZD,SUB,364,18,ZD),182,19))                       
                                                                               
 WER813I  INSTALLATION OPTIONS IN MFX LOAD LIBRARY WILL BE USED                 
 WER903I  SYNCSORT 2.1.0.0 IS NOT LICENSED FOR SERIAL 31BE7, TYPE 2964 718, LPAR
 WER903I  PRODUCT WILL STOP WORKING IN  44 DAYS UNLESS A VALID KEY IS INSTALLED.
 WER251A  INCLUDE/OMIT INVALID COND                                             
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 

is there a syntax error or, with the sort, I can not do what previously described?

the output dataset was previously allocated.

thank you
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 02, 2015 3:26 pm    Post subject: Reply to: Build record according subtraction result
Reply with quote

Quote:
is there a syntax error or, with the sort, I can not do what previously described?


Well, both. Because you cannot do that in the manner you are attempting, you obviously are creating a syntax error when you attempt to do so. You can't have an expression in a condition.

You have to do the calculation before the test, storing the result in an extension to the record, and then use that field in the condition. Use IFTHEN=(WHEN=INIT for this.

You have to ensure that the extension does not persist on your output. Since you already have BUILD to get the data from the REFORMAT record, that should not be a problem, you won't need to do anything extra.
Back to top
View user's profile Send private message
witsche

New User


Joined: 04 May 2005
Posts: 3

PostPosted: Fri Oct 02, 2015 6:41 pm    Post subject:
Reply with quote

in effect, to obviate this problem, I modified IFTHEN so that writes the subtraction result in the same position and, in a next job step, I controlled if in that location the value is positive or negative: in the first case I leave everything so while in the second I overturn the value in another field.

thanks for your help
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 02, 2015 7:16 pm    Post subject: Reply to: Build record according subtraction result
Reply with quote

There is no need to do anything in a separate step. If you show your working code, we can show how to do it in one step.
Back to top
View user's profile Send private message
witsche

New User


Joined: 04 May 2005
Posts: 3

PostPosted: Fri Oct 02, 2015 7:47 pm    Post subject:
Reply with quote

at the moment I'm fine, eventually I will contact you later
thanks again
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Oct 02, 2015 8:49 pm    Post subject: Reply to: Build record according subtraction result
Reply with quote

OK, I'll be eagerly awaiting an opportunity to be of service at your convenience.

Or not.
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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