Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us