View previous topic :: View next topic
|
Author |
Message |
radhakrishnan82
Active User
Joined: 31 Mar 2005 Posts: 435 Location: chennai, India
|
|
|
|
For single file, I understand hw to check for empty records in it and how to handle. I have 5 files to check for empty and process accordingly.
can you please confirm whether I could handle empty file condition in seperate steps for each file or can i handle the empty file condition in single step. If i can handle in single step, please let me know about the details. Thanks for your help. |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
If you want to set a return code separately you should go for seperate steps. If not you can handle that using an IDCAMS or a ICETOOL using multiple input files. |
|
Back to top |
|
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
Things you might need to consider here is - In case you providing all the 5 files into the ICETOOL to check for empty condition.
Code: |
COUNT FROM(IN1) EMPTY
COUNT FROM(IN2) EMPTY
COUNT FROM(IN3) EMPTY
COUNT FROM(IN4) EMPTY
COUNT FROM(IN5) EMPTY
|
Suppose if the file3 and file4 is empty, the conditions will get executed until the file3 and subsequent check for the remaining files are skipped. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
when all files are tested in a single step, how do you then determine which is the empty file if any ?
I think the option of testing each file in a separate step is the way to go.
Gerry |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
gcicchet wrote: |
when all files are tested in a single step, how do you then determine which is the empty file if any ? |
Not impossible, if you issue a return code between 0 (no empty files) and 31 (all files are empty), but processing it will rather complex. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
... check for empty records in multiple files.. |
Quote: |
... can you please confirm whether I could handle empty file condition ... |
after 457 post You should have learned how to express Yourself better in order to get proper help
just take a decision... what do You want to check
empty ( whatever it means ) records
or empty ( not containing any records) files
until You learn how to use proper IT terminology we are just wasting time! |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Robert,
I agree wholeheartedly with your comments and yes processing the files would become rather messy but achievable.
Gerry |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Possibly i misunderstand, but i believe the request is how to do this with the sort or idcams or similar.
With any of these, i believe it will be more work than radhakrishnan will want to invest (even if it is possible).
If these can be concatenated, it would be possible to interleave a "header" before each file and then use prino's suggestion about the return code. If one was willing to write their own code, this would take very little time. If these cannot be concatenated, it would require 5 fd's rather tha none, but then no "file headers" would be needed. . .
Quote: |
If i can handle in single step, please let me know about the details. |
The details would completely depend on how the processing after the "empty checks" was to be done. Determining if there are any empty files may be less challenging than determining the rest of the processing. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
all depends on the quirks of the return code to be provided!
if the TS has to handle all the combination of empty files,
a rexx wrapper is the best way, in order to build a proper return code
from right to left
bit 0 on for first file empty
bit 1 on for second file empty
...
bit 4 for the fifth file empty
the return code could be flipped the other way around but the logic would not change
I wonder about the requirement ...
but from a mathematics and logic point of view it' s a sound solution
something like
Code: |
000001 //USER1 JOB NOTIFY=&SYSUID,
000002 // MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X
000003 //*
000004 //IKJ EXEC PGM=IKJEFT1B,PARM='CHECKER'
000005 //SYSPROC DD DISP=SHR,DSN=USER.TEST.CLIST
000006 //*
000007 //DD01 DD *
000008
000009 //DD02 DD *
000010 //DD03 DD *
000011 //DD04 DD *
000012 //DD05 DD *
000013
000014 //SYSTSIN DD *
000015 //SYSPRINT DD SYSOUT=*
000016 //SYSTSPRT DD SYSOUT=*
|
and USER.TEST.CLIST would contain a member called CHECKER
Code: |
000001 /* rexx */
000002 retRC = 0
000003 Address TSO
000004 "print infile(dd01) count(1)"
000005 if rc <> 0 then retRC = retRC + 1
000006 "print infile(dd02) count(1)"
000007 if rc <> 0 then retRC = retRC + 2
000008 "print infile(dd03) count(1)"
000009 if rc <> 0 then retRC = retRC + 4
000010 "print infile(dd04) count(1)"
000011 if rc <> 0 then retRC = retRC + 8
000012 "print infile(dd05) count(1)"
000013 if rc <> 0 then retRC = retRC + 16
000014 return retRC
|
quick and dirty, no frills, just for a proof of concept
since files 2,3,4 are ampty a return code 14 is produced 2+4+8 |
|
Back to top |
|
|
|