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

Dealing with FB and VB file in a single module


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ravi Kuchi

New User


Joined: 29 May 2012
Posts: 14
Location: INDIA

PostPosted: Thu Jul 19, 2012 4:30 pm
Reply with quote

Hi Friends,

Is there a possibility to write an assembler module that could open a file (it could be either FB or VB) and check if it is empty or not ?
or else
do we need to have seperate modules for each of these kind?

Thanks!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 19, 2012 4:38 pm
Reply with quote

posting a question on an internet forum is RESEARCHING?

in addition to being either FB or VB, is the DSN (Dataset Name) known at run-time,
or is this dynamic?

also, do you differentiate between allocated
and allocated/opened/closed
when you mean empty?

IF the DSN is known at run-time, there are plenty of threads in the
DFSORT forum (as well as the JCL forum - syncsort as well as IBM utilities)
that deal with this question
that you could research.

So is this a question about Assembler
or the function of determining if a file is empty?
Back to top
View user's profile Send private message
Ravi Kuchi

New User


Joined: 29 May 2012
Posts: 14
Location: INDIA

PostPosted: Thu Jul 19, 2012 4:57 pm
Reply with quote

Yes, The DSN name is known at run time.

Let me explain the assembler module we are trying to build.

1) The module should open the file.
2) If the file open is succesful, then it would try to read the first record.
3) If the file open is not successful then it should return with return-code 8
4) If a record is present then it should close the file and exit with return code of 4
5) If the file is empty then it should exit with return code of Zero.

Hope, I am clear.

Thanks
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: Thu Jul 19, 2012 9:25 pm
Reply with quote

Hello,

It is still not clear to me if the goal is the process to determine if the file is empty or the goal is just to write some assembler icon_confused.gif

What does "open not successful" mean? If the file does not exist, it cannot be opened and if named in the JCL will cause a jcl error before the code is even running.

As DBZ mentioned, look in the sort and jcl parts of the forum as there are several topics dealing with detecting an empty file.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jul 19, 2012 10:29 pm
Reply with quote

If you issue an IDCAMS PRINT COUNT(0) and the RC=04, then the file is empty. COUNT(0) prevents records from being printed as their contents might not be for non-authorized eyes. Management likes precautions like this.... icon_wink.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 20, 2012 1:48 pm
Reply with quote

Quote:

If you issue an IDCAMS PRINT COUNT(0) and the RC=04, then the file is empty.


Really Bill ?


Code:

IDCAMS  SYSTEM SERVICES                                           TIME:


08:47:20        07/20/12     PAGE   1


 REPRO IFILE(DUMMY) OFILE(OUTPUT)

IDC0005I NUMBER OF RECORDS PROCESSED WAS 0

IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0


 PRINT IFILE(OUTPUT) COUNT(0)

IDCAMS  SYSTEM SERVICES                                           TIME: 08:47:20        07/20/12     PAGE   2


LISTING OF DATA SET -SYS12202.T084720.RA000.XIBFIDC.R0000001

IDC0005I NUMBER OF RECORDS PROCESSED WAS 0

IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0

IDCAMS  SYSTEM SERVICES                                           TIME: 08:47:20        07/20/12     PAGE   3




IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jul 20, 2012 2:13 pm
Reply with quote

It's Friday Peter, go slow...icon_smile.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 20, 2012 2:23 pm
Reply with quote

Anuj, just saying have a nice week-end.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 20, 2012 2:38 pm
Reply with quote

Well the strange thing is :

with a PRINT of
COUNT(0) will give a max cond code of 0
COUNT(1) will give a max cond code of 4

with a repro of the empty file to another dummy dataset :

without COUNT will give a max cond code of 0
with COUNT(1) will give a max cond code of 4
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: Fri Jul 20, 2012 6:48 pm
Reply with quote

Hello,

Well, it "successfully" processed zero records . . . hence the cc zero?
And unsuccessfully processes one record - so the cc 4?

The successful count of zero records varified the existence of the file (which would have caused a jcl error if it did not exist)?

Yup, kinda strange. . .
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jul 20, 2012 9:00 pm
Reply with quote

Peter,

COUNT(1) is the correct choice, returning an RC=04 for an empty file.

I've used this for many years. But, as CRS kicks in icon_sad.gif , I may have been thinking of a VSE environment, where COUNT("whatever") returns an RC=04 for an empty file.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat Jul 21, 2012 12:23 am
Reply with quote

Hallo Bill,

with all respect, i was just doing some tests with that idcams stuff. And did you mean with CRS this ? :

crs.org/
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sat Jul 21, 2012 1:20 am
Reply with quote

Hi Peter,

Actually, CRS is correct (Can't Remember Sh*t).

icon_lol.gif icon_lol.gif icon_lol.gif
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top