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

check for empty records in multiple files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 435
Location: chennai, India

PostPosted: Sat Mar 05, 2011 12:53 pm
Reply with quote

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
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Sat Mar 05, 2011 4:04 pm
Reply with quote

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
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Sat Mar 05, 2011 4:18 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sun Mar 06, 2011 1:50 pm
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Sun Mar 06, 2011 5:47 pm
Reply with quote

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. icon_lol.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Mar 06, 2011 9:20 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Mar 07, 2011 4:19 am
Reply with quote

Hi Robert,

I agree wholeheartedly with your comments and yes processing the files would become rather messy but achievable.


Gerry
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Mar 07, 2011 5:24 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Mar 07, 2011 6:06 am
Reply with quote

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
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top