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

To match records with the body record and trailer record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Wed Jun 13, 2007 4:15 pm
Reply with quote

Hi could anyone please help me regarding this

I have got a dataset with header record, body record and trailer record
for example

1111 H00000000000200606150000000000
2222 r12262537378882823827382783723
3333 r12312312312342342342345345345
4444 r44234363452144756765776876876
5555 t 00000 0003 000000000000000000

here in the above example 1111 is the header record
2222 till 4444 is the body record
and 5555 is the trailer record where 0003 is the no of the body records.

I just want to count the letter R in the body record (as only one r will be there in each record ) and to compare it with trailer record 0003 whether it is equal or not. If its not equal or if it is zero i want to make it an abended job with error code 16

I have got an idea of doing with copy command but could anyone please get me the control card for this requirement
Thanks in advance
Tony
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Jun 13, 2007 9:26 pm
Reply with quote

Quote:
I just want to count the letter R in the body record


R or r?

Is that character always in position 6 or can it be anywhere in the record?

What is the RECFM and LRECL of the input file?

Is the header record always indicated by 1111 in positions 1-4? Is the trailer record always indicated by 5555 in positions 1-4? Or is it actually more complicated than that (e.g. the header record is the first record and nothing in that record indicates it's the header, and the trailer record is the last record and nothing in that record indicates it's the trailer)?

Quote:
If its not equal or if it is zero i want to make it an abended job with error code 16


An abend and a RC=16 are two different things. Which one do you want?
Back to top
View user's profile Send private message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Thu Jun 14, 2007 12:46 am
Reply with quote

Thanks for ur consideration
wat i have given as 1111 is the line number so the R is the first letter of the record ( the letter is R. )
The header record contains the date and some other data & the header record is always indicated by the first letter H
The Trailer record contains the number of body record and some other data & the trailer record is always indicated by the first letter H
some times dataset comes only with the header and the trailer record and sometimes there is a mismatch in the record count in the trailer record.
So i need to check the Body record whether there is any record in the dataset starting with letter R and if so the record count matches the trailer records count indicator.
I need to set the RC as 16 if there is no body record i.e no records in dataset starting with letter R.And if the count mismatches.
Thanks in advance
Tony jose
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Jun 14, 2007 1:22 am
Reply with quote

Quote:
The Trailer record contains the number of body record and some other data & the trailer record is always indicated by the first letter H


You mean T for the trailer, not H - right?

Quote:
I need to set the RC as 16 if there is no body record i.e no records in dataset starting with letter R.And if the count mismatches.


You mean or, not and - right?

Again, what is the RECFM and LRECL of the input file?

Please try to be more precise when describing your requirements to avoid confusion.
Back to top
View user's profile Send private message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Thu Jun 14, 2007 3:59 pm
Reply with quote

Thanks for ur interest

yup T for Trailer Not H
The second quote is right
and The recfm is fb and lrecl is 80

Thank in adavnce ,
Tony Jose
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Jun 14, 2007 9:39 pm
Reply with quote

Here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 to use NULLOUT=RC16. If you have DFSORT R14, you can set up the job to use ICETOOL COUNT instead of NULLOUT=RC16.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TRL DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    INCLUDE=(1,1,CH,EQ,C'R'),
    TRAILER1=('RCOUNT,+',COUNT=(M11,LENGTH=4))
  OUTFIL FNAMES=TRL,INCLUDE=(1,1,CH,EQ,C'T'),
    OVERLAY=(2:C'0000')
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DUMMY
//SYSIN    DD    *
  OPTION COPY,NULLOUT=RC16
  OMIT COND=(2,4,ZD,EQ,RCOUNT,OR,9,4,ZD,NE,RCOUNT)
/*
Back to top
View user's profile Send private message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Fri Jun 15, 2007 7:39 pm
Reply with quote

Hi Frank thanks a lot for such a great effort u have taken for me.


I have tried submitting the job with the appropriate input dataset in the sortin and got an error code 16 even though everything looks fine as the count and the body record count is equal i am bit confused with control cards. And can u please tell me why ur using the overlay since overlay is used for formatting purpose and why we are using it here.
And wat the zd in the control card omit Cond implies for .
Wat changes we have to do in case for different record format and for other record length.
Could u please explain me these.
Thanks in advance .
Tony Jose [/quote]
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Fri Jun 15, 2007 9:14 pm
Reply with quote

Too many questions at once.

Let's start with your statement that you got an error code 16 when you thought you shouldn't (at least I think that's what you're saying).

You need to show me an example of the input records that produce the RC=16 you don't expect, and the //SYSOUT messages from step S1 and step S2 in that case.
Back to top
View user's profile Send private message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Mon Jun 18, 2007 4:43 pm
Reply with quote

Hi frank

Here i have given the input file and the sysout message for both the steps.

Input file -- PTP037.TEST.INPUT1 (seq)

H0000000000200606150000000000
R2262537378882823827382783723
R2312312312342342342345345345
R4234363452144756765776876876
T0000000003000000000000000000

step s1 sysout message

ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 14:55 ON FRI JUN
OPTION COPY
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
INCLUDE=(1,1,CH,EQ,C'R'),
TRAILER1=('RCOUNT,+',COUNT=(M11,LENGTH=4))
OUTFIL FNAMES=TRL,INCLUDE=(1,1,CH,EQ,C'T'),
OVERLAY=(2:C'0000')
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K90007 C6-K90007 C7-K90000 C8-K90007 E9-K90007 C9-BASE E5-K14794
ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED
ICE088I 0 PTP037XX.S1 . , INPUT LRECL = 80, BLKSIZE = 800, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6291456)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6234096,6234096)
ICE127I 0 OPTIONS: OVFLO=RC16,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERE
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXITC
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=2097152,SOLRF=Y,VLLONG=N
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE084I 0 EXCP ACCESS METHOD USED FOR SORTIN
ICE231I 0 STORAGE USED FOR OUTFIL : BELOW 16M = 23552, ABOVE 16M = 4191232
ICE210I 0 SYM : EXCP USED, LRECL = 80, BLKSIZE = 27920, TYPE = FB (SDB)
ICE084I 0 EXCP ACCESS METHOD USED FOR SORTIN
ICE231I 0 STORAGE USED FOR OUTFIL : BELOW 16M = 23552, ABOVE 16M = 4191232
ICE210I 0 SYM : EXCP USED, LRECL = 80, BLKSIZE = 27920, TYPE = FB (SDB)
ICE210I 0 TRL : EXCP USED, LRECL = 80, BLKSIZE = 27920, TYPE = FB (SDB)
ICE751I 1 EF-K10929 CB-K90000 F0-Q84357 E8-K11698
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 5, OUT: 5
ICE227I 0 SYM : DELETED = 5, REPORT = 1, DATA = 0
ICE228I 0 SYM : TOTAL IN = 5, TOTAL OUT = 1
ICE227I 0 TRL : DELETED = 4, REPORT = 0, DATA = 1
ICE228I 0 TRL : TOTAL IN = 5, TOTAL OUT = 1
ICE174I 0 NO DATA RECORDS FOR AN OUTFIL DATA SET - RC=0
ICE052I 0 END OF DFSORT

step s2 sysout message

ICE270I 0 PROCESSING SYMNAMES STATEMENTS
ICE280I 1 ORIGINAL STATEMENTS FROM SYSIN FOLLOW
OPTION COPY,NULLOUT=RC16
OMIT COND=(2,4,ZD,EQ,RCOUNT,OR,9,4,ZD,NE,RCOUNT)
ICE282I 0 PERFORMING SYMBOL SUBSTITUTION AS NEEDED
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 14:55 ON FRI JU
OPTION COPY,NULLOUT=RC16
OMIT COND=(2,4,ZD,EQ,+3,OR,9,4,ZD,NE,+3)
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K90007 C6-K90007 C7-K90000 C8-K90007 E9-K90007 C9-BASE E5-K14794 E7-K11698
ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED
ICE088I 0 PTP037XX.S2 . , INPUT LRECL = 80, BLKSIZE = 27920, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6286430)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6220062,6220062)
ICE127I 0 OPTIONS: OVFLO=RC16,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,RESET=Y,VSAMEMT=Y,DYNSPC=256
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ERET=RC16 ,MSGDDN=SYSOUT
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=N,DYNALOC=N ,ABCODE=MSG
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=N,STIMER=Y,COBEXIT=COB2
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=Y,DSA=0
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXITCK=S,PARMDDN=DFSPARM ,FSZEST=N
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMIO=N,MOSIZE=MAX
ICE235I 0 OPTIONS: NULLOUT=RC16
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT
ICE084I 0 EXCP ACCESS METHOD USED FOR SORTIN
ICE751I 1 EF-K10929 F0-Q84357 E8-K11698
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 27920, TYPE = FB
ICE055I 0 INSERT 0, DELETE 1
ICE054I 0 RECORDS - IN: 1, OUT: 0
ICE206A 0 NO RECORDS FOR THE SORTOUT DATA SET - RC=16
ICE052I 0 END OF DFSORT

Quote:
HI frank this is the message i have got in the sysout .I think step s1 is ok we have got problem in s2 on setting up the return code
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Jun 18, 2007 8:38 pm
Reply with quote

I thought your count was at 9,4 but it appears it's at 8,4.

So just change:

Code:

  OMIT COND=(2,4,ZD,EQ,RCOUNT,OR,9,4,ZD,NE,RCOUNT)


to:

Code:

  OMIT COND=(2,4,ZD,EQ,RCOUNT,OR,8,4,ZD,NE,RCOUNT)
Back to top
View user's profile Send private message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Tue Jun 19, 2007 4:18 pm
Reply with quote

Hi frank thanks a lot now its working fine. Really a good one But i have some doubts regarding the control cards you have given

OVERLAY=(2:C'0000') could you please tell wat for u have used this and where u have specificied the file format whether it should be fb or vb or fbe .
could you please tell me this.

Thanks in advance
Tony Jose
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Jun 19, 2007 8:26 pm
Reply with quote

Quote:
where u have specificied the file format whether it should be fb or vb


You said the input file has RECFM=FB and LRECL=80 so that's what I assumed with:

//SORTIN DD DSN=... input file (FB/80)

Quote:
OVERLAY=(2:C'0000') could you please tell wat for u have used this


The first step sets up two files as follows:

SYM has:

RCOUNT,+n

where n is the count of the R records.

TRL has:

T0000000003000000000000000000

I needed a 0000 constant to check RCOUNT against, so I used the OVERLAY=(2:C'0000') to make sure I had 0000 in positions 2-5 of the trailer record. I could have put it anywhere in the trailer record (except where your count is). I didn't know if your trailer record always had 0000 in positions 2-5 as shown in your example, so I decided not to assume that.

The second step has:

Code:

  OMIT COND=(2,4,ZD,EQ,RCOUNT,OR,8,4,ZD,NE,RCOUNT)


RCOUNT is the count of R records. 2,4,ZD is the 0000 I put in the trailer record so I could check +0 vs RCOUNT.
Back to top
View user's profile Send private message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Tue Jun 19, 2007 11:31 pm
Reply with quote

hi Frank thanks once again and
one more thing can i add or minus value to the count to meet some requirment

In case my value in the trailer is showing 0005 as adding the header and the trailer record and so i need to add the count value plus 2 so that our count value now equals the trailer count value

will this do
Quote:

TRAILER1=('RCOUNT,+',COUNT+2=(M11,LENGTH=4))

(tried but not yet got)

If not how can i add value to the rcount
And wats this m11 denotes in this code

Thanks a lot
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Jun 20, 2007 1:00 am
Reply with quote

Yes, you can use COUNT+2 with DFSORT. I don't know what you mean by "tried but not yet got".

However, if you want RCOUNT to include the header and trailer record, you just have to change:

Code:

  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    INCLUDE=(1,1,CH,EQ,C'R'),
    TRAILER1=('RCOUNT,+',COUNT=(M11,LENGTH=4))


to

Code:

  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
    TRAILER1=('RCOUNT,+',COUNT=(M11,LENGTH=4))


INCLUDE=(1,1,CH,EQ,C'R') gives you the count of just the R records. Without it, you'll get the count of all of the records.

Does that mean you want check for RCOUNT=2 instead of RCOUNT=0 for the no R records case? If so, you can change OVERLAY=(2:C'0000') to OVERLAY=(2:C'0002').

Quote:
And whats this m11 denotes in this code


M11 is one of DFSORT's 27 edit masks. M11 gives a numeric output value with leading zeros. See:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.8?DT=20060615173822

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
jose.jeyan

New User


Joined: 28 Jul 2006
Posts: 60
Location: Mumbai

PostPosted: Wed Jun 20, 2007 12:34 pm
Reply with quote

Thanks alot icon_razz.gif
Got it.

Is there any training in IBM for dfsort . Please let me know if there is any, way to get trained on DFSORT.

Any Training sessions conducted by IBM if so.

with Loads of thanks
Tony Jose
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Jun 20, 2007 8:31 pm
Reply with quote

Quote:
Please let me know if there is any, way to get trained on DFSORT.


The best way to get trained on DFSORT is to read through "z/OS DFSORT: Getting Started" as I suggested above.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top