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
 
JCL to compare counts

 
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: Wed Apr 20, 2005 8:45 pm    Post subject: JCL to compare counts
Reply with quote

I would like to do the following in a JCL using SYNCSORT or any other tool. We do not have DFSORT.

I have a dataset with the last record (trailer record) containing
number of records in the dataset excluding the trailer.
I would like to count the number of records (excluding the trailer
record) and compare the number with the value stored as the first 13
bytes of the trailer record. If both numbers are equal, I would like to
set the RC = 0 in the JCL.


Example
DRU034
CPC045
RFK056
0000000000003
Back to top
View user's profile Send private message

SteveConway

New User


Joined: 26 May 2005
Posts: 28
Location: Northern VA, USA

PostPosted: Thu May 26, 2005 10:27 pm    Post subject: Re: JCL to compare counts
Reply with quote

This will require programming of one sort or another. I include REXX and CLIST and batch TSO/ISPF in 'programming'. There isn't a JCL facility to do what you want.

Cheers,,,Steve
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri May 27, 2005 6:24 am    Post subject:
Reply with quote

Quote:
This will require programming of one sort or another. ... There isn't a JCL facility to do what you want.


Not sure if you're including DFSORT/ICETOOL in "programming", but this can be done with DFSORT/ICETOOL. Since the poster said "We do not have DFSORT", I did not post a DFSORT/ICETOOL solution.
Back to top
View user's profile Send private message
Deepa.m
Warnings : 1

New User


Joined: 28 Apr 2005
Posts: 99

PostPosted: Fri May 27, 2005 4:05 pm    Post subject:
Reply with quote

Interested to know how it can be done in DFSORT.
if this set continues N times in the file ..how will you repeat the comparison.??
Back to top
View user's profile Send private message
SteveConway

New User


Joined: 26 May 2005
Posts: 28
Location: Northern VA, USA

PostPosted: Fri May 27, 2005 7:59 pm    Post subject: Re: JCL to compare counts
Reply with quote

In reply to Frank Yeager:
You learn something everyday! Well, I do, anyway. :-)
I did not know DFSORT could compare a derived value like record count to a value contained within an output record.
I'll just toddle off and RTFM now.

Cheers,,,Steve
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri May 27, 2005 8:56 pm    Post subject:
Reply with quote

Quote:
Interested to know how it can be done in DFSORT.


Here's a DFSORT/ICETOOL job that does what was asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//TOOLIN   DD    *
* Create one record as follows:
* dddddddddddddxxxxxxxxxxxxx
* where ddddddddddddd is the record count in the last record.
* xxxxxxxxxxxxx is the actual count - 1.
 COPY FROM(IN) USING(CTL1)
* If ddddddddddddd is equal to xxxxxxxxxxxxx, set RC=0.
* If ddddddddddddd is not equal to xxxxxxxxxxxxx, set RC=12.
 COUNT FROM(T1) EMPTY USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
   TRAILER1=(1,13,COUNT-1=(M11,LENGTH=13))
/*
//CTL2CNTL DD *
   INCLUDE COND=(1,13,CH,EQ,14,13,CH)
/*
Back to top
View user's profile Send private message
SteveConway

New User


Joined: 26 May 2005
Posts: 28
Location: Northern VA, USA

PostPosted: Fri May 27, 2005 9:40 pm    Post subject: Re: JCL to compare counts
Reply with quote

Very cool, Frank. You continue to educate me. Much appreciated.


Cheers,,,Steve
Back to top
View user's profile Send private message
bigreddastud

New User


Joined: 19 Jan 2006
Posts: 6

PostPosted: Thu Jan 19, 2006 4:33 am    Post subject:
Reply with quote

Not to bring up a dead topic, but I was in a similar situation, and my site has syncsort not DFSORT so I thought I was screwed. I did some digging, and found a solution using syncsort:

Code:

//******************************************
//****COUNT RECORDS IN FILE USING SYNCSORT
//******************************************
//STEPH        EXEC PGM=SORT
//SYSOUT       DD SYSOUT=*
//SORTIN       DD DS=MY.INFILE.TOCOUNT,
//  DISP=SHR
//SORTOUT      DD DSN=THE.INFILE.RECORD.COUNT,
//  DISP=(NEW,CATLG,CATLG),
//  DCB=(RECFM=FB,LRECL=008),
//  UNIT=SYSDA,
//  SPACE=(TRK,(1,1))
//SYSIN        DD DATA
    SORT FIELDS=COPY
    OUTFIL NODETAIL,REMOVECC,TRAILER1=(COUNT)
/*


THIS CODE WILL COUNT THE RECORDS IN THE SORTIN FILE AND CREATE A 1 RECORD FILE WITH ONLY THE NUMBER OF RECORDS IN THE INFILE UP TO 8 BYTES (UP TO 99999999):

LIKE:
Code:
*****123


WHERE * = A LEFT PADDING SPACE

>>>>>PLEASE REMEMBER<<<<<
I AM TERRIBLE WITH MAINFRAME, so don't bother asking me for help. I merely stumbled across a workable pre-built solution in use that worked for me so I decided to share it with others. I do not have the knowledge to, nor did I actually come up with this code myself!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jan 19, 2006 4:58 am    Post subject:
Reply with quote

bigred,

What you show is NOT what was asked for. What you show merely gives the count of the input records, and has been shown numerous times on this board by myself and others. The actual requirement, satisfied by the DFSORT/ICETOOL job I showed was the following:

Quote:
I have a dataset with the last record (trailer record) containing
number of records in the dataset excluding the trailer.
I would like to count the number of records (excluding the trailer
record) and compare the number with the value stored as the first 13
bytes of the trailer record. If both numbers are equal, I would like to
set the RC = 0 in the JCL.
Back to top
View user's profile Send private message
bigreddastud

New User


Joined: 19 Jan 2006
Posts: 6

PostPosted: Thu Jan 19, 2006 7:49 pm    Post subject:
Reply with quote

Frank Yaeger wrote:
bigred,

What you show is NOT what was asked for. What you show merely gives the count of the input records, and has been shown numerous times on this board by myself and others. The actual requirement, satisfied by the DFSORT/ICETOOL job I showed was the following:

Quote:
I have a dataset with the last record (trailer record) containing
number of records in the dataset excluding the trailer.
I would like to count the number of records (excluding the trailer
record) and compare the number with the value stored as the first 13
bytes of the trailer record. If both numbers are equal, I would like to
set the RC = 0 in the JCL.


Sure, but this solution is for SYNCSORT not DFSORT/ICEMAN. You are correct though that it doesn't meet the original guy's requirements, I posted it in the wrong thread.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jan 19, 2006 8:36 pm    Post subject:
Reply with quote

FYI, your count job will work for DFSORT as well.
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 Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Updating multiple counts in trailer!! Vignesh Sid SYNCSORT 4 Mon Nov 06, 2017 1:04 pm
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

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