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

Compare values in a file using JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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
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
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
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
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
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
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
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 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 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top