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

Getting the filename while reading


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2358
Location: Israel

PostPosted: Sat Mar 03, 2007 10:53 pm
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
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: 2358
Location: Israel

PostPosted: Sun Mar 04, 2007 2:02 am
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

Moderator Emeritus


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

PostPosted: Sun Mar 04, 2007 8:12 am
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
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

Moderator Emeritus


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

PostPosted: Sun Mar 04, 2007 9:57 am
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
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
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

Moderator Emeritus


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

PostPosted: Mon Mar 05, 2007 8:31 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Rexx program reading a DSN then write... CLIST & REXX 4
No new posts Connect:Direct Add yesterday date in ... All Other Mainframe Topics 3
No new posts Reading subsequent rows in a query. DB2 12
Search our Forums:

Back to Top