In words, the requirement is check if there are any 'D' records in the input. If any, then produce the output like shown above and put the count from the trailer record.
If there are no 'D' records, set return code to 4
Can this be done using syncsort?
I built this card, but it doesn't return 4 when there are no '02'. Also, I know why it doesn't, it is because of the INCLUDE. Here H1,H2 are the symbols I used to put the text
Code:
OPTION COPY,NULLOUT=RC4
INCLUDE COND=(1,2,ZD,EQ,02,OR,1,2,ZD,EQ,99)
OUTFIL IFTHEN=(WHEN=(1,2,ZD,EQ,99),
BUILD=(H1,80:X,/,&DATE,X,H2,X,4,7,80:X)),
OMIT=(1,2,ZD,EQ,02)
Why are you even looking for a '02' record? If there is No '02' record then the trailer count must be 0000000 (Or there may not be a trailer at all). If trailer count is greater than 0 (Or if there is a trailer) then that means there must be a detail record. So, you can only look at trailer count to tell whether you have a detail record (and their count). Isn't it?
That is the ideal case, but we don't want to trust the input since it was manually prepared. So, we want to check what was 'actually' sent in the input.
That is the ideal case, but we don't want to trust the input since it was manually prepared. So, we want to check what was 'actually' sent in the input.
RahulG31 is right.
You can not pretend the mistakes and code for the whole world.
This link will help you to do what you want in a prior step.
ibmmainframes.com/about57751.html
or think how to twist more if you would like to merge in one step.
You can not pretend the mistakes and code for the whole world.
Agreed, but the fundamentals needed for the functionality to work in the first place need to be verified before such functionality is triggered. So, for any file with header, details and trailer, we tend to verify if the detail records exist or count is as same as the trailer. These validations run day in and day out in all the shops I worked.
I do know how to do it, but this one is different, I only asked for a suggestion. If you look at my piece of code, I did achieve what I could for the first part. I was not asking how to count the records from the input file(like your piece of code does), I said to pull the count from the trailer.
Thanks for your effort spent on my ask. I will look for other options.
So, ultimately you want me to do the job for you which I nearly did in the previous post but you are Not even able to think on how to make a simple change.
Since you don't even know how to read a JCL/Sort card, I would like to tell that you are Not creating 2 files, and that is what I said in my previous post to have OUT2 as Dummy. Out2 is only used to give you RC4 when needed.
Mods, Please Lock the topic. Enough of the crap already.
I didn't say you do the whole job for me, I was missing something in my original card.
If you just see my control card, I have the same INCLUDE condition like yours now and we both have the same build statements too, except I used symbols since they are long in size.
so, like I said I did the majority part. I even coded NULLOUT I was only missing to join both in one step.
The only piece missing was the last one OUT2. I noticed you put DUMMY, but the thing is it will try to copy ALL the records even though it is Dummy. Dummy essentially means a temp file for JES, there would I/O involved. Dummy doesn't mean that it doesn't create any file. you can just run the card and see the sysout, so I was trying to reduce the I/O.
So, I am really thankful for your efforts. I am not sure why you are getting upset at the lines, those are only questions.
I've leveraged the missing piece Rahul provided with OUT2 and hooked it into my card and added ACCEPT parm to just copy one record. So, I think the piece works now. It looks like this now.
Code:
OPTION COPY
INCLUDE COND=(1,2,ZD,EQ,02,OR,1,2,ZD,EQ,99)
OUTFIL BUILD=(H1,80:X,/,&DATE,X,H2,X,48,7,80:X),FNAMES=OUT1,
OMIT=(1,2,ZD,EQ,02)
OUTFIL FNAMES=OUT2,NULLOFL=RC4,SAVE,ACCEPT=1
but the thing is it will try to copy ALL the records
If you don't want to copy all the records then just use STARTREC and ENDREC (=1) in OUTFIL and that will give you only a single record in OUT2. That way you are Not copying all the records. BUT you say that you'll look for other options.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Amar,
If you are just trying to validate the trailer count AND to check if you have '02' records in it, you could do something like this and then forget worrying about the two outputs.
I don't have Syncsort, but this should get you going.
You might want to modify the BUILD below as in your original card to format the SORTOUT, the way you wanted to. Good luck.
Beautiful, Arun . Yeah that is another way look at the requirement. Always, the count must be the same as the Trailer and that condition check can be leveraged for returning the code 4. I think I just need to hook my Build card and use it.