Page 1 of 2

IDCAMS Utiility

PostPosted: Thu Apr 23, 2009 3:58 pm
by navennaik
Hello,

In my procedure step I have found the sysin ststement as below.

PRINT INFILE(IDCAMI) COUNT(3)

Where IDCAMI is the input files logical name. This utility is used for finding out whether the input file is empty or not , by giving the RC=04 if the file is empty.

How this SYSIN statement works.I mean What is the meaninig of COUNT(3) in the above SYSIN statement and how this works in finding out the file is empty or not.

Please Help me out.

Thanks,
Naveen

Re: IDCAMS Utiility

PostPosted: Thu Apr 23, 2009 4:16 pm
by swd
The COUNT(3) means print the first 3 records of the dataset. It will give a RC=4 if there are 0,1 or 2 records in the file, so to use this to check if the file is empty is not quite correct as if there are 1 or 2 records in the file it will still give RC=4 because there are not enough records in the file, so it gives you a warning.

Specify COUNT(1) will be better to check if the file is empty, as if there are 1 or more records in the file you get RC=0, if there are no records in the file you get RC=4.

Hope this helps
CHeers
Steve

Re: IDCAMS Utiility

PostPosted: Thu Apr 23, 2009 5:24 pm
by navennaik
Thank you So much ,
Naveen.

Re: IDCAMS Utiility

PostPosted: Mon Jun 04, 2012 4:22 pm
by sinmani
Suppose I have a file with headers and Trailers.

I want that if only 1 trailer is present in the entire file No processing should be done.

How can we achieve this using IDCAMS??

Re: IDCAMS Utiility

PostPosted: Mon Jun 04, 2012 4:45 pm
by Robert Sample
No processing should be done.
What does this mean? If you do NO processing, then you cannot use a computer AT ALL to do this, so it becomes totally and completely IMPOSSIBLE. Further, to do it -- with IDCAMS or any other program -- will require knowing what identifies a header record, what identifies a trailer record, and what identifies detail records.

Re: IDCAMS Utiility

PostPosted: Mon Jun 04, 2012 6:20 pm
by sinmani
It means the software should not be executed and all other steps bypassed. Just check in first step if only one trailer is there and if yes bypass all other steps.

Header and trailer could be like Header = *****Name, account No, Amount Wealth in header
and Trailer ***** continue on next page >>>

Re: IDCAMS Utiility

PostPosted: Mon Jun 04, 2012 7:01 pm
by Robert Sample
Just check in first step if only one trailer is there
This REQUIRES a software program be executed.

What you want to do cannot be done, period.

Re: IDCAMS Utiility

PostPosted: Tue Jun 05, 2012 8:04 am
by dick scherrer
Hello,

Suggest you consider using your sort product or actually writing some code (i.e. COBOL or Easytrieve are quie common).

IDCAMS has some features, but it is not intended to be a programming language.

Re: IDCAMS Utiility

PostPosted: Tue Jun 05, 2012 5:51 pm
by sinmani
Hmm okkk,

I am thinking if I can consider to include how many records I am expecting per page.

Suppose each page has 1 header + 20 records + 1 trailer= 22.

So if I code INFILE(INDAMI) COUNT (22)

So if now records is greater than 22 then I will get RC = 4 or else 0.

So I proceed for RC = 4 and If RC= 0 bypass all furthur steps.

Re: IDCAMS Utiility

PostPosted: Tue Jun 05, 2012 6:02 pm
by NicC
No - if count is greater than 22 you will get a return code of 0. I return code of not zero is returned from utilities when they cannot do what was requested - in your case read 22 records.

I suspect that you have no idea of what you are doing and definitely no idea of the tools available. Why not run through the task with a colleague?