MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Check if value in file1 is >= to value in file2 using sor

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
vishu19aug
Beginner


Joined: 19 Jan 2007
Posts: 4
Topics: 1
Location: Pune

PostPosted: Thu Jun 28, 2007 4:42 am    Post subject: Check if value in file1 is >= to value in file2 using sor Reply with quote

Hi,
I two files one contains airthmatic value before any operation and the other has after i have to check if the valuein second file is greater than the first.

Thanks,
Vishal
_________________
Vishal Gupta,
Infosys Technologies Lmtd.
Pune, INDIA
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12401
Topics: 75
Location: San Jose

PostPosted: Thu Jun 28, 2007 4:59 am    Post subject: Reply with quote

vishu19aug,

Please follow the board rules. Use meaningful topics. Do NOT use the Forum name as title for the topic.

1. What is the LRECL and RECFM of the files involved on the comparision

2. What is the position and format of the field to be compared. Is there a key. If so what is the position and format of that?

3. Post us a sample input and desired output

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vishu19aug
Beginner


Joined: 19 Jan 2007
Posts: 4
Topics: 1
Location: Pune

PostPosted: Thu Jun 28, 2007 6:35 am    Post subject: Reply with quote

I appologies for not follwoing the board rules, will take care of this in future.

1. LRECL for botht the files is 15 and RECFM = FB

2. Position of variables starting from 2 to 11, Numeric field.

3. Input data of file1 -' 0000000012'
data for file2 - ' 0000000013'

What i want is, if the value of second file is greater step should end with some return code else with RC 0 .
_________________
Vishal Gupta,
Infosys Technologies Lmtd.
Pune, INDIA
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12401
Topics: 75
Location: San Jose

PostPosted: Thu Jun 28, 2007 7:40 am    Post subject: Reply with quote

vishu19aug,

1. Do you always have just 1 row in each file?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vishu19aug
Beginner


Joined: 19 Jan 2007
Posts: 4
Topics: 1
Location: Pune

PostPosted: Thu Jun 28, 2007 11:29 pm    Post subject: Reply with quote

Kolusu,
Yeah i always have one row in the file.

Vishu19aug
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12401
Topics: 75
Location: San Jose

PostPosted: Fri Jun 29, 2007 7:16 am    Post subject: Reply with quote

vishu19aug,

Try this

1. concatenate both files to sortin DD. Using IFTHEN we add a seqnum and based on that we change the sign of the first file value and sum it up and thus ending up with just 1 record. Now we use an include to see if the summed value is less than or equal to zero. If the summed value is less than zero than the file1 value is greater than file 2


DFSORT Solution:

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD  SYSOUT=*                         
//SORTIN   DD  DSN=INPUT FILE1,
//             DISP=SHR
//         DD  DSN=INPUT FILE2,
//             DISP=SHR
//SORTOUT  DD  SYSOUT=*                         
//SYSIN    DD  *                               
  SORT FIELDS=(16,1,CH,A)                       
  SUM FIELDS=(2,10,ZD)                           

  INREC IFTHEN=(WHEN=INIT,                       
       OVERLAY=(16:SEQNUM,1,ZD)),               
        IFTHEN=(WHEN=(16,1,ZD,EQ,1),             
       OVERLAY=(02:+0,SUB,2,10,ZD,ZD,LENGTH=10, 
               16:C'2')) 
                     
  OUTFIL NULLOFL=RC4,INCLUDE=(02,10,ZD,LE,0)
/*                                               


SYNCSORT Solution:
Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD  SYSOUT=*                         
//SORTIN   DD  DSN=INPUT FILE1,
//             DISP=SHR
//         DD  DSN=INPUT FILE2,
//             DISP=SHR
//SORTOUT  DD  SYSOUT=*                         
//SYSIN    DD  *
                               
  OPTION NULLOUT=RC4                           
  SORT FIELDS=(16,1,CH,A)                       
  SUM FIELDS=(2,10,ZD)                         

  INREC IFTHEN=(WHEN=INIT,                     
       OVERLAY=(16:SEQNUM,1,ZD)),               
        IFTHEN=(WHEN=(16,1,ZD,EQ,1),           
       OVERLAY=(02:+0,SUB,2,10,ZD,ZD,LENGTH=10,
                16:C'2'))                       

  OUTFIL INCLUDE=(02,10,ZD,LE,0)               
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vishu19aug
Beginner


Joined: 19 Jan 2007
Posts: 4
Topics: 1
Location: Pune

PostPosted: Mon Jul 02, 2007 5:14 am    Post subject: Reply with quote

Kolusu,

It's working Laughing
Thanks a lot for the help.

Regards,
Vishu19aug
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group