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
 

 

Reading input files which contains in a dataset.....
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Sat Jul 17, 2010 12:11 pm    Post subject: Reading input files which contains in a dataset.....
Reply with quote

I have one input file which contains the only names of 25 files. These input files names will change on daily basis.
I want to read all these 25 input files using COBOL program. Is it possible or not ?

Input file just contain the 25 files names, first i should read this input file then i have to read 25 input files for processing.

Can anyone explain how to proceed further...
Back to top
View user's profile Send private message

Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Sat Jul 17, 2010 12:19 pm    Post subject:
Reply with quote

Hi Naresh,

Keyword : BPXWDYN

Do a search for BPXWDYN in this forum and you will know how to proceed further... icon_biggrin.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Sat Jul 17, 2010 1:14 pm    Post subject:
Reply with quote

One of the things that I question more and more and more is the thought and preparation that goes into building these applications.

Never in the past have I encountered this non knowledge of which files are to be processed by any particular job. Everything was static, and dare I say efficient. None of this extra processing to determine which files need processing.

Is it just me that thinks this way.

I just bet that the support people just love it when one of these jobs abends.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Sat Jul 17, 2010 2:11 pm    Post subject:
Reply with quote

Amen to that, expat.
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: Sat Jul 17, 2010 10:13 pm    Post subject:
Reply with quote

Hi Expat,

Quote:
Never in the past have I encountered this non knowledge of which files are to be processed by any particular job.
In the past things were actually designed. . . Now, many are just thrown together and someone has to figure out how to use the pieces. . .

The most successful implementations of this type of process that i've worked with was to generate a new +1 for each file and then process the entire gdg as a single file. . . Rather simple actually. . .

@Naresh -
Quote:
I have one input file which contains the only names of 25 files. These input files names will change on daily basis.
I want to read all these 25 input files using COBOL program. Is it possible or not ?
If these files do not all have the same dcb info, you won't be able to read them with the "same" code. . .
Back to top
View user's profile Send private message
icemanroh

New User


Joined: 23 Aug 2008
Posts: 25
Location: Mumbai

PostPosted: Wed Jul 21, 2010 1:05 pm    Post subject:
Reply with quote

BPXWDYN is used for Dynamic allocation of files within a COBOL program. But the utility requires all details in order to allocate a Dataset. Below is a sample command which needs to be used in order to allocate a dataset. U can allocate GDGs PS files using this utility.

ALLOC DD(OUTPUTFL) DSN(DOC.DYNAM.TEST) LRECL(00100) BLKSIZE(01000) RECFM(F,B) DATACLAS(LARGE) NEW CATALOG DSORG(PS)

CALL 'BPXWDYN' USING WS-COMMAND-STRING.

Once the allocation is complete u can open file in Input mode & start processing as u do in any program.

As mentioned by Dick if the file format of all files is going to change then it becomes a problem. If only the file names are changing then its very easy.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Jul 21, 2010 1:13 pm    Post subject:
Reply with quote

icemanroh wrote:
If only the file names are changing then its very easy.
It may be easy for the programmer, but as stated above, it will not be easy for the people designated to support these types of applications.

But hey, why think about doing things properly when a hasty thrown together hotchpotch of crazy ideas will work icon_evil.gif
Back to top
View user's profile Send private message
icemanroh

New User


Joined: 23 Aug 2008
Posts: 25
Location: Mumbai

PostPosted: Wed Jul 21, 2010 1:22 pm    Post subject:
Reply with quote

Some time back I had such a requirement so I created couple of generic copybooks which can be used to allocate files dynamically & Im willing to share if this thread starter wants it.
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Wed Jul 21, 2010 1:22 pm    Post subject: Reply to: Reading input files which contains in a dataset...
Reply with quote

All the files are of same format and same length.
I have coded as below, whether this procedure is correct or not ? Can anyone suggest me........Any errors please correct me...

DATA DIVISION.

FILE SECTION.

FD IN-FILE
RECORDING MODE IS F
LABEL RECORDS ARE STANDARD
BLOCK CONTAINS 0 RECORDS
DATA RECORD IS IN-REC.

01 IN-REC PIC X(80).
05 IN-FILE-NAME PIC X(80).

WORKING-STORAGE SECTION.

01 BPXWDYN PIC X(08) VALUE 'BPXWDYN'.
01 S-EOF-FILE PIC X(01) VALUE 'N'.
01 PDS-STRING.
05 PDS-LENGTH PIC S9(4) COMP VALUE 100.
05 PDS-TEXT PIC X(100) VALUE
'ALLOC DD(INFILE) DSN(''EMPLOYEE.INPUT.FILE)'') SHR'.

MOVE SPACES TO PDS-STRING
STRING 'FREE FI(INFILE) DSN(' IN-FILE-NAME ') SHR'
DELIMITED BY SIZE
INTO PDS-STRING

CALL BPXWDYN USING PDS-STRING

IF RETURN-CODE = ZERO
READ IN-FILE-NAME AT END MOVE '1' TO IN-EOF
DISPLAY DATA ...............

ELSE
GO TO 4000-ABEND-PARA
END-IF
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Wed Jul 21, 2010 1:24 pm    Post subject: Reply to: Reading input files which contains in a dataset...
Reply with quote

Hi Rohit,

Could you please share with us.. so that it will be helpful for me
Back to top
View user's profile Send private message
icemanroh

New User


Joined: 23 Aug 2008
Posts: 25
Location: Mumbai

PostPosted: Wed Jul 21, 2010 2:03 pm    Post subject: Reply to: Reading input files which contains in a dataset...
Reply with quote

Upload these three to mainframes & rename them to create copybook/pgm as below:

DYNAM.CODECPY.txt -> Code in copybook format (Rename: DYNAMAL)
DYNAM.CPY.txt -> Copybook for Filename & attribute details (Rename: DYNAMCPY)
DYNAM.CODE.txt -> A sample test program to show how to use the copybooks.
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Thu Jul 22, 2010 12:40 pm    Post subject: Reply to: Reading input files which contains in a dataset...
Reply with quote

Can anyone correct the errors in the above code.. so that it will be helpful for me...........
Back to top
View user's profile Send private message
icemanroh

New User


Joined: 23 Aug 2008
Posts: 25
Location: Mumbai

PostPosted: Thu Jul 22, 2010 12:48 pm    Post subject: Re: Reply to: Reading input files which contains in a datase
Reply with quote

nareshdacha wrote:
Can anyone correct the errors in the above code.. so that it will be helpful for me...........


Ur command is wrong it should be something like below. Change DCB as per ur need.

ALLOC DD(INFILE) DSN(EMPLOYEE.INPUT.FILE) LRECL(00100) BLKSIZE(01000) RECFM(F,B) SHR

PDS-STRING should contain above.
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: Thu Jul 22, 2010 7:14 pm    Post subject:
Reply with quote

Hello,

Quote:
Can anyone correct the errors in the above code.. so that it will be helpful for me...........
Sorry to rain on the parade, but if you do not understand the code well enough to work with it, maybe it should not be implemented.

No organization wants code in use that the "author" (you) cannot support. . .

Possibly there is something i misunderstand. . .
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Fri Jul 23, 2010 10:49 am    Post subject: Reply to: Reading input files which contains in a dataset...
Reply with quote

As i already mentioned above, this question was asked in interview..
Just i tried to implement that scenario in real-time......

Thanks to all ..............
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: Fri Jul 23, 2010 7:32 pm    Post subject:
Reply with quote

Hello,

Quote:
As i already mentioned above, this question was asked in interview..
Ahhh, ummm, errr. . . Not in this topic icon_confused.gif

Anyway it is good if you have an answer you can use icon_smile.gif
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Fri Jul 30, 2010 3:02 pm    Post subject: Reply to: Reading input files which contains in a dataset...
Reply with quote

I downloaded the file given above and tried to run the given program but it failed with below error. the SPOOL sysout shows as below

Code:

=== PGM DYNAMTST STARTED  ===           ,,
DOC.              .TEST       DYNAM     ....
***********************************************
ALLOCATING DATASET USING COMMAND : ALLOC    DD(OUTPUTFL) DSN(DOC.DYNAM.TEST) LRECL(00100),BLKSIZE(01000) RECFM(F,B) DATA
CLAS(LARGE) NEW CATALOG DSORG(PS)
***********************************************
DYNAMALL  : FILE ALLOCATION        ¦ SUCCESS  ¦
***********************************************
IGZ0035S There was an unsuccessful OPEN or CLOSE of file OUTPUTFL in program DYNAMTST at relative location X'0C28'.
         Neither FILE STATUS nor an ERROR declarative were specified. The status code was 96.
         From compile unit GCMDYNAM at entry point GCMDYNAM at unit offset +00000C28 at entry offset +00000C28
          at address 2E300C28.
<> LEAID ENTERED (LEVEL 04/01/2008 AT 12.32)
<> LEAID PROCESSING COMPLETE. RC=0


and my run jcl looks as below

Code:


//ASPUROHA JOB   ('A'),'NIL',CLASS=G,
// MSGCLASS=Y,NOTIFY=ASPUROH,USER=ASPUROH
//**
//STEP01 EXEC PGM=GCMDYNAM
//STEPLIB DD DISP=SHR,DSN=SYSE.TE.MER1.ALL.LOADB
//INPUTFL DD DSNAME=TRTEGCM.TEST.FILE1,DISP=OLD
//



Please let me know if I need to add any step in my run JCL.

Regards,
Nilesh
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Jul 30, 2010 4:33 pm    Post subject:
Reply with quote

What does your SELECT look like? What does the OPEN statement look like?
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Fri Jul 30, 2010 5:15 pm    Post subject: Reply to: Reading input files which contains in a dataset...
Reply with quote

I am just running the program given by icemanroh in the same message thread given earlier. Just check previous replies and download link provided by Rohit.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jul 30, 2010 6:23 pm    Post subject:
Reply with quote

nileshyp wrote:
I am just running the program given by icemanroh in the same message thread given earlier. Just check previous replies and download link provided by Rohit.


**sigh** (or actually ROFL )
since the code in the other thread works and yours doesn't,
maybe something is wrong with your code,
which means for us to look at something that you do not have,
could be useless, as well as a waste of our time.

I personally would not hold my breath, if I were you, awaiting on helpful responses.
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 24 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


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