Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Getting the filename while reading

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
JanWouter

New User


Joined: 02 Mar 2007
Posts: 6
Location: Netherlands

PostPosted: Sat Mar 03, 2007 6:43 pm    Post subject: Getting the filename while reading
Reply with quote

I'm in need of a way to determine the dsn-name of a file that I'm reading when I'm using concatenated files.
This is to be able to make counts on each file in a concatenation.
Does anybody know of a way how to do this?
Any help would be greatly appreciated.
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Sat Mar 03, 2007 10:53 pm    Post subject:
Reply with quote

The JFCBDSNM field of the JFCB data area will contain the dataset name.

Other methods are:
1. Call REXX that will call LISTDSI with the FILE keyword, and return the dataset name in SYSDSNAME.
2. Invoke the TSO command LISTALC (either from within COBOL or by calling REXX), then parse the output.

O.
Back to top
View user's profile Send private message
JanWouter

New User


Joined: 02 Mar 2007
Posts: 6
Location: Netherlands

PostPosted: Sun Mar 04, 2007 12:39 am    Post subject: Re: Getting the filename while reading
Reply with quote

I know of the JFCB area, but will this also give me the information about the current file that is being read?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Sun Mar 04, 2007 2:02 am    Post subject:
Reply with quote

Assuming you know the DDNAME, you can navigate your way to JFCBDSNM through TIOEDDNM. Look for examples (mainly REXX and Assembler) in Google.

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

Site Director


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

PostPosted: Sun Mar 04, 2007 8:12 am    Post subject:
Reply with quote

Hello,

When you find some code that will do what you want, i'd suggest that you make it a callable routine that you call pass in the DDNAME and have the routine pass back the current DSN.

If you want a count by dsn, you'll want to call the routine after each read and increment your counters accordingly.

When you have it running, you might also post the routine here icon_smile.gif
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Sun Mar 04, 2007 9:08 am    Post subject:
Reply with quote

In SAS it's easy to get Dataset name using JFCB.

If you are looking for SAS code reply I can post SAS code for you. It's just less than 5 lines of code.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Sun Mar 04, 2007 9:57 am    Post subject:
Reply with quote

Hello,

Will SAS allow retrieving the DSN after each record is read?
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Sun Mar 04, 2007 10:09 am    Post subject:
Reply with quote

My Bad... If its concatenation then I doubt.
Back to top
View user's profile Send private message
JanWouter

New User


Joined: 02 Mar 2007
Posts: 6
Location: Netherlands

PostPosted: Mon Mar 05, 2007 1:53 pm    Post subject: Re: Getting the filename while reading
Reply with quote

It is concatenation I'm talking about. And the files in the concatenation may vary. So I only know 1 dd-name for several files.
Today I'm going to see what info the jfcb gives me. If I tackle the problem I will post it here.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Mar 05, 2007 8:31 pm    Post subject:
Reply with quote

Hello,

Yes, i believe jfcb is a good way to go. Just remember to check the dsn after each read for the current dsn as you want to count records by dsn.

If so desired, you could also go thru the control blocks and get all of the dsns in the concatenation and so know which files you had as input before reading all of the records. This might be useful if the code needed to know if a given dsn was in the concatenation at the start of the run.

Good luck icon_smile.gif
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Tue Jun 19, 2007 8:30 pm    Post subject: Re: Getting the filename while reading
Reply with quote

Has anyone gotten this to work? A complete working example of this would be great! Although I do not have a need for it at the present time, I can see uses for it in the future.
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Tue Jun 19, 2007 8:50 pm    Post subject: Re: Getting the filename while reading
Reply with quote

Have you reviewed the information in this previous topic?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts Fail to change physical VSAM filename... jacobdng CICS 7 Fri Jan 20, 2017 12:36 pm
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts Reading selected volumes of a multi-v... RickBig JCL & VSAM 6 Wed Jul 13, 2016 7:26 pm
No new posts Reading from File 1 and Writing to Fi... shiitiizz CLIST & REXX 2 Thu May 14, 2015 5:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us