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
 

 

creating a flat file using COBOL dynamically using BPXWDYN

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

New User


Joined: 13 Apr 2007
Posts: 7
Location: Chennai

PostPosted: Thu Apr 24, 2008 11:14 pm    Post subject: creating a flat file using COBOL dynamically using BPXWDYN
Reply with quote

Dear All,

I created a file dynamically using COBOL and the assembler program BPXWDYN. But i am not able to open the file which i created , as the requirement for us is to pass the record length of the file during run time. Since we define the record paramters in the FD section as
FD FILEIN
BLOCK CONTAINS 0 RECORDS
RECORD CONTAINS 0 CHARACTERS
RECORDING MODE IS F.

01 FD-GDG-IN-RECORD PIC X(1000).

and then specify the allocation parameters in the procedure division which need not be with a record length of 1000 i am getting file status 39.
Please let me know how to avoid file status 39 when i need to create each time a file of different record length. I am struggling a lot with this

ALLOC DD(DYNCRE) DSN('test.file') MSG(WTP) NEW CYL SPACE(10,10) KEEP LRECL(200)
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Apr 24, 2008 11:22 pm    Post subject:
Reply with quote

Are you opening INPUT or OUTPUT?
Back to top
View user's profile Send private message
mangalrajnm

New User


Joined: 13 Apr 2007
Posts: 7
Location: Chennai

PostPosted: Thu Apr 24, 2008 11:31 pm    Post subject: Reply to: creating a flat file using COBOL dynamically using
Reply with quote

I am opening in OUTPUT mode
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Apr 24, 2008 11:43 pm    Post subject:
Reply with quote

From the Enterpise COBOL Language Reference.

Quote:
Must be an unsigned integer that specifies the number of bytes contained in each record in the file. The RECORD CONTAINS 0 CHARACTERS clause can be specified for input QSAM files containing fixed-length records; the record size is determined at object time from the DD statement parameters or the data set label.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Apr 24, 2008 11:51 pm    Post subject: Reply to: creating a flat file using COBOL dynamically using
Reply with quote

Just a thought.

Can't you stick with a standard file record-length (1000) temporary dataset for the COBOL program. Then, right before ending the program, write out a proper SORT control file, and call DFSORT or SYNCSORT to easily create the cataloged dataset in the desired record length.
Back to top
View user's profile Send private message
mangalrajnm

New User


Joined: 13 Apr 2007
Posts: 7
Location: Chennai

PostPosted: Thu May 01, 2008 10:13 pm    Post subject:
Reply with quote

Dear All,
My challenge is that I want my output file's length to be determined at run time (390 or enterprise Cobol). I want it to be fixed (not variable), but potentially a different fixed length each time it runs. This length could EITHER be taken from the JCL DD statement (new allocated file, complete with DCB information) or calculated in the program -- either approach works for me, although the latter is preferred. From all my reading, it appears that to use the information from the JCL, I *should* be able to code the output file FD with "RECORD CONTAINS 0 CHARACTERS". However, the Cobol compiler gives an error on the OPEN OUTPUT for this FD: IGYPA3143-E Physical "SEQUENITAL" file "OUT-FILE" specified in an "OPEN OUTPUT" or "OPEN EXTEND" statement was defined with a "RECORD CONTAINS 0 CHARACTERS" clause. The statement was processed as written. This works fine for the input files, by the way, but I can't figure out how to do so for the output file.

Please let me know how to do this as it is very critical for our project
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 May 01, 2008 10:31 pm    Post subject:
Reply with quote

Hello,

I suggest you re-read the quote from the cobol manual posted above. . . If we can believe IBM, it only works for input files.

Quote:
Please let me know how to do this as it is very critical for our project
If it is that critical and the volume is not too high, create the file at the longest possible fixed length and then reformat it in another utility step (sort, iegbener, etc).
Back to top
View user's profile Send private message
Douglas Wilder

Active User


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

PostPosted: Thu May 01, 2008 11:28 pm    Post subject:
Reply with quote

At one time I used a COBOL program Sort exit for a situation like this. Sort passed each input record to the COBOL exit, the COBOL program processed the records and passed it back to sort to be written out. The COBOL program did not need to work with the actual length of the record sort and JCL took care of that. The COBOL program just had to allocate the longest allowed record length.
Back to top
View user's profile Send private message
mangalrajnm

New User


Joined: 13 Apr 2007
Posts: 7
Location: Chennai

PostPosted: Thu May 01, 2008 11:31 pm    Post subject:
Reply with quote

Hi Dick,

Thanks a lot for your timely reply icon_smile.gif . Can I proceed using a sort step to reformat the file?
Back to top
View user's profile Send private message
mangalrajnm

New User


Joined: 13 Apr 2007
Posts: 7
Location: Chennai

PostPosted: Thu May 01, 2008 11:35 pm    Post subject:
Reply with quote

I thank each and every one who has provided me your valuable thought icon_smile.gif
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 May 01, 2008 11:43 pm    Post subject:
Reply with quote

You're welcome icon_smile.gif

Quote:
Can I proceed using a sort step to reformat the file?
Sure. If you look in the DFSORT or JCL sections of the forum (depending on whether you have DFSORT or Syncsort), there are examples of reformatting data.

There should also be info in the appropriate manual.
Back to top
View user's profile Send private message
jasorn

Active User


Joined: 12 Jul 2006
Posts: 153
Location: USA

PostPosted: Fri May 16, 2008 10:34 am    Post subject:
Reply with quote

I spent a decent amount of time on this same problem. And the sort step is the only approach I could get to work. I thought I worked somewhere once that called an assembler program to do this but I haven't been able to find anyone there who knows what I'm talking about so I must have been mistaken.
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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