Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Select Clause in cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Mon Aug 09, 2010 10:50 am    Post subject: Select Clause in cobol
Reply with quote

Hi All,

I have a scenario where there are four files of same attribute (LRECL and RECFM).

Can i Assign all these files to same Label in the DATA DIVISION as below.

SELECT CLOCKFILE ASSIGN TO DD1
SELECT CLOCKFILE ASSIGN TO DD2
SELECT CLOCKFILE ASSIGN TO DD3
SELECT CLOCKFILE ASSIGN TO DD4

Where CLOCKFILE is PIC(100).

Or can we do as below
SELECT CLOCKFILE ASSIGN TO DD1 DD2 DD3 DD4

I guess second is not possible but guess first one is logically correct.

But while processing we have to be very careful.

Please guide me on this.

Thanks
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 Aug 09, 2010 10:57 am    Post subject:
Reply with quote

Hello,


Unfortunately, both are incorrect. Neither should successfully compile.

Suggest you use:
Code:
SELECT CLOCKFILE1 ASSIGN TO DD1
SELECT CLOCKFILE2 ASSIGN TO DD2
SELECT CLOCKFILE3 ASSIGN TO DD3
SELECT CLOCKFILE4 ASSIGN TO DD4


If you were considerable more experienced, you might use dynamic allocation, but this will take you much more time than simply coding the routines for each file.

If there is no concern over which file is currently being processed, the 4 files could be concatenated in one DD statement.
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 Aug 09, 2010 11:00 am    Post subject:
Reply with quote

Hello,

Quote:
But while processing we have to be very careful.

Why might this require more care than some other program/requirement?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Mon Aug 09, 2010 1:40 pm    Post subject: Re: Select Clause in cobol
Reply with quote

vpr_118 wrote:
Can i Assign all these files to same Label in the DATA DIVISION as below.

SELECT CLOCKFILE ASSIGN TO DD1
SELECT CLOCKFILE ASSIGN TO DD2
SELECT CLOCKFILE ASSIGN TO DD3
SELECT CLOCKFILE ASSIGN TO DD4
You said "these files" - that means more than one file, then why do you ask to use the "same name" for all of them, they all are different files - are not they?
Back to top
View user's profile Send private message
vpr_118
Warnings : 1

New User


Joined: 07 Apr 2008
Posts: 64
Location: chennai

PostPosted: Mon Aug 09, 2010 5:04 pm    Post subject: Reply to: Select Clause in cobol
Reply with quote

Hi,

But while processing we have to be very careful..

Though all the files have same attributes, there might be a requirement where i will process the records in each of them in different manner.

In that case if i read 1st file, and then if i read the 2nd file, the data of 2nd file will present in the File layout (overrides the data of 1st file in the layout which is prescribed in data division).

I mean this was just a case which i thought. There could me many scenarios,

So what i understand is "We can not define or assign four different files though having same attributes to a single layout.

Yes we can concatenate and give that DD name alone in the assign clause.

But as the case mentioned above, where requirement is to process the records in each of file with different logic, then only way out is to have 4 SELECT clauses with their respective layouts.

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

Global Moderator


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

PostPosted: Mon Aug 09, 2010 5:37 pm    Post subject:
Reply with quote

Quote:
But as the case mentioned above, where requirement is to process the records in each of file with different logic, then only way out is to have 4 SELECT clauses with their respective layouts.


so little imagination!

have you thought of using an intervening file which would indicate which file follows when you concatenate?
Code:

//input dd dsn=firstfile.identifier
//        dd dsn=firstfile
//        dd dsn=secondfile.identifier
//        dd dsn=secondfile
...

where firstfile.identifier and secondfile.identifier
would be of the same dcb as the the others, contain one record
but would contain info that idicated that this is an identifier file
and that the following file is ...
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 -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us