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
 

 

Compare values in a file using JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
dharmadam_man

New User


Joined: 20 Apr 2005
Posts: 8

PostPosted: Tue Apr 26, 2005 11:17 pm    Post subject: Compare values in a file using JCL
Reply with quote

I have a dataset with one record. The record layout is as follows.
I have a number in a field starting from position 1 thru 13 (with leading zeroes). Another number starting in position 18 (no leading zeroes). I want to take the number from position 18, subtract 1 and then compare with the number in position 1 thru 13. If the numbers are not equal, I want to set the RC (return code) to 4 or greater.

I do not have DFSORT, but have SYNCSORT and FILEAID. Can someone suggest a way to achieve this.
Back to top
View user's profile Send private message

somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Wed Apr 27, 2005 3:37 am    Post subject:
Reply with quote

dharmadam_man

Try this job. If you have SYNCSORT you should be able to run it.
This will give a return code of 12 if the numbers are not equal.
Assuming the file is FB and LRECL=80

Code:

//STEP1 EXEC  PGM=SYNCTOOL               
//TOOLMSG DD SYSOUT=*                   
//DFSMSG DD SYSOUT=*                     
//IN DD *                               
0000000010123    10124                   
/*                                       
//T1 DD DSN=&&T1,DISP=(,PASS)           
//T2 DD DSN=&&T2,DISP=(,PASS)           
//*                                     
//TOOLIN DD *                           
  SORT FROM(IN) USING(CTL1)             
  COPY FROM(T1) USING(CTL2)             
  COUNT FROM(T2) EMPTY                   
/*                                       
//CTL1CNTL DD *                         
  SORT FIELDS=COPY                       
  OUTFIL FNAMES=T1,                     
    OUTREC=((18,05,ZD,SUB,+1),1,50,80:X)
/*                                 
//CTL2CNTL DD *                   
  OUTFIL FNAMES=T2,               
  INCLUDE=(1,15,ZD,EQ,17,13,ZD)   
/*                                 
//                                 


hth
-Som
Back to top
View user's profile Send private message
dharmadam_man

New User


Joined: 20 Apr 2005
Posts: 8

PostPosted: Wed Apr 27, 2005 11:12 pm    Post subject: Re: Compare values in a file using JCL
Reply with quote

Som,

Thanks for posting this code. It worked well. I have a question though. The number of digits in the count value, here 10124, can vary. How does the statement OUTREC=((18,05,ZD,SUB,+1),1,50,80:X) would look?
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Thu Apr 28, 2005 1:14 am    Post subject:
Reply with quote

dharmadam_man

Please post the layout of the file?

Regds
-Som
Back to top
View user's profile Send private message
dharmadam_man

New User


Joined: 20 Apr 2005
Posts: 8

PostPosted: Thu Apr 28, 2005 10:52 pm    Post subject:
Reply with quote

The layout is included. The count of records in the file is stored starting at position 18, but its length can vary. Please see the eamples.

0000000101235 101236
0000001012 1013
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Thu Apr 28, 2005 11:39 pm    Post subject:
Reply with quote

Hi
What I meant by the layout is the COBOL copy book. Do you have it? OR what is the maximum length of this field (the count field)?

Regds
-Som
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Fri Apr 29, 2005 6:48 pm    Post subject:
Reply with quote

Hi
The examples that you had given in the previous post is different from what you described in the first post.
You have mentioned
Quote:

I have a number in a field starting from position 1 thru 13 (with leading zeroes).

But in the example
Code:


0000000101235 101236
0000001012 1013



This should be

Code:

-----------13 18----
0000000101235 101236
0000000001012   1013


If the input is as given above all you need to change is

OUTREC=((18,05,ZD,SUB,+1),1,50,80:X) to
OUTREC=((18,X,ZD,SUB,+1),1,50,80:X) where X is the maximum length of your numeric field (Assuming it's less than or equal to 15 - In SYNCSORT the maximum for a ZD field is 15 digits)


hth
-Som
Back to top
View user's profile Send private message
dharmadam_man

New User


Joined: 20 Apr 2005
Posts: 8

PostPosted: Fri Apr 29, 2005 6:52 pm    Post subject:
Reply with quote

There is no COBOL layout. The file is created by this JOB step.
//JS030 EXEC PGM=SORT
//SORTIN DD DSN=CMKJNT.ABC.CLAIM.EXTTERNAL.G0018V00,
// DISP=SHR
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=CMKJNT.ABC.CLAIM.EXTERNAL.COUNT,
// DISP=(NEW,CATLG,CATLG),
// UNIT=SYSDA,
// SPACE=(CYL,(20,5),RLSE),
// DCB=(ACSNS.DSCB,BLKSIZE=0,LRECL=88,RECFM=FB
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(1,13,15:COUNT)
/*
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Fri Apr 29, 2005 8:06 pm    Post subject:
Reply with quote

dharmadam_man

So your count field's starting position is 15.

So change it as follows and let us know the outcome.

OUTREC=((15,08,ZD,SUB,+1),1,50,80:X)

Regds
-Som
Back to top
View user's profile Send private message
dharmadam_man

New User


Joined: 20 Apr 2005
Posts: 8

PostPosted: Tue May 03, 2005 1:09 am    Post subject:
Reply with quote

Yes. It worked well. Thanks for your help.
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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