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

Dynamic file creation in PLI with variable length


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Mon Jul 11, 2011 5:39 pm
Reply with quote

HI,

I need to create a file dynamically in PL/I with variable length. If I'm not giving any recfm options, its creating VB file, but i need to create a variable file.

If i'm giving options like RECFM = V or LRECL then its throwing ONCODE=111.

Is there any way to create a file dynamically with the required record format, and record length.

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

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 11, 2011 5:45 pm
Reply with quote

Quote:
its creating VB file, but i need to create a variable file
Either this is a typo, or you need to learn what "VB" means.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 11, 2011 5:57 pm
Reply with quote

Like Robert, I'm unclear as to what you mean.

V is Variable, Unblocked
VB is Variable, Blocked

Unless you have some requirement specifically for unblocked, you already have what you want.
Back to top
View user's profile Send private message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Mon Jul 11, 2011 6:59 pm
Reply with quote

Hi,

I meant Variable unblocked file. By default its creating a variable blocked file. Any options to create the required one,

Thanks
Anjum
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 11, 2011 7:06 pm
Reply with quote

OK, I'll bite. Why does it have to be unblocked?

Can you post the relevant code, using the Code button above the input box?
Back to top
View user's profile Send private message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Mon Jul 11, 2011 7:17 pm
Reply with quote

hi,

the output file from this program is going as input to some other JCL which is used to load some VSAM file. Dont know why exactly a variable file is used. Also the requirement is to give the max record length, which i'm not able to achieve it. I'm able to code SPACE, disposition etc, but not record format and rec size.

Any suggestions as how to include them,

Regards,
Anjum Raza
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 11, 2011 7:33 pm
Reply with quote

The variable bit is easy. If there are records of different lengths on the file, then it has to be variable. If all the records are the same length, then it is more sensible for it to be a fixed format file.

What I don't get, is why unblocked? If a file is blocked, it is much more efficient to read/write (unless you make a mess of the selection of the blocksize).

Until you post your code, I doubt you'll get much further here.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Mon Jul 11, 2011 8:03 pm
Reply with quote

In my opinion, if the records are of different length, but either close or not too many records, then FB is still best. One reason: this allows sort parms to specify field positions as documented without having to add 4 for the VB length field.

I'm sure others may disagree, and I am open to your reasons.
Back to top
View user's profile Send private message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Mon Jul 11, 2011 9:34 pm
Reply with quote

it is unblocked because there are different layouts that are written to the file and it is unknown as to which layout is written. I mean the file is to have different record structures. Hope this answers to your question.

can you tell me any method to generate the variable file dynamically thru program or at-least how to include the logical record length. the sample code
is below:

MAST1 = 'DSN(USER.';
MAST2 = 'USERID';
MAST3 = '.';
MAST4 = 'SAMPL1';
MAST5 = '),NEW,CATALOG';
MAST6 = ',LRECL=80';
MAST0 = MAST1 || MAST2 || MAST3 || MAST4 || MAST5 || MAST6;
OPEN FILE(SUCCESS) RECORD OUTPUT TITLE(MAST0);

the file success is opened here dynamically,

Regards,
Anjum
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Jul 11, 2011 9:44 pm
Reply with quote

Quote:
it is unblocked because there are different layouts that are written to the file and it is unknown as to which layout is written. I mean the file is to have different record structures. Hope this answers to your question.

horse manure

it would be wise to review Your understanding of data management!
blocked VS non blocked has nothing todo with the record layout full stop

building records with different layouts is satisfied simply by the Variable paradigm

programs should not / are not usually concerned with the BLOCKED <thingie>

You should try and post real evidence of misbehavior !
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Mon Jul 11, 2011 9:54 pm
Reply with quote

Continuing my FB discussion, even FB records can have different layouts. You merely need (as with VB) some field to indicate which layout pertains to a given record so you know which section of code and which variable names to use for each record type.
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 Jul 11, 2011 10:04 pm
Reply with quote

Hello,

Quote:
even FB records can have different layouts.
Indeed - this is quite common.

Quote:
it is unblocked because there are different layouts that are written to the file and it is unknown as to which layout is written.
Re-read the observation from Enrico. . .

No matter whether you have fixed or variable length records, you will still need to know "what you have".

You can probably also create a complete performance / space usage mess if you try to create an unblocked file. . .

If you more clearly and completely explain what you "have" as input and what you want as output (show sample data records), someone may have a suggestion.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 11, 2011 10:08 pm
Reply with quote

anjumraza wrote:
it is unblocked because there are different layouts that are written to the file and it is unknown as to which layout is written. I mean the file is to have different record structures. Hope this answers to your question.

[...]


No. Sorry. There's no good way to say this, this is just complete rubbish, I'm afraid. Heck, I'll go with enrico's comment.

There is utterly no relationship between blocked or un-blocked and the record-layout.

If you don't know how to identify which layout was used, by having a record-type in a fixed position on each record, then you will make the job of reading the file logically absurdly difficult. Irrespective of whether blocked or unblocked. All that the blocked/unblocked is telling anything is whether to store the data more efficiently in big chunks with a physical i/o per chunk on the recording-media, or as individual records with a physical i/o per record (slower, you'll notice for any sizable dataset).
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 11, 2011 10:53 pm
Reply with quote

Quote:
Is there any way to create a file dynamically with the required record format, and record length.
Maybe, or maybe not, depending upon many factors -- whether the data set you are trying to build is under SMS control, what ACS routines are defined at your site, and so forth. It may be that your site does not allow an unblocked data set to be built with the high level qualifier you are using, for example.

Since you have, thoroughly and completely, shown that you have absolutely no idea what you are doing -- your best bet is to contact your site support group and work with them. Your second best bet is to take a mainframe course that teaches you the difference between logical (record layout) and physical (blocking).
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 11, 2011 11:32 pm
Reply with quote

Phrzby Phil wrote:
In my opinion, if the records are of different length, but either close or not too many records, then FB is still best. One reason: this allows sort parms to specify field positions as documented without having to add 4 for the VB length field.

I'm sure others may disagree, and I am open to your reasons.


Any other reasons?

I'd use SYMNAMES with DFSORT. Then no worry about adding four every time I wanted a sort card, just spell out the name.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 12, 2011 12:06 am
Reply with quote

Phrzby Phil wrote:
Continuing my FB discussion, even FB records can have different layouts. You merely need (as with VB) some field to indicate which layout pertains to a given record so you know which section of code and which variable names to use for each record type.


Reminiscing about punched-card data files?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Jul 12, 2011 12:21 am
Reply with quote

Why the heck do you need to do dynamic allocation? Just specify it in your JCL.
Back to top
View user's profile Send private message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Tue Jul 12, 2011 6:14 pm
Reply with quote

Hi All,

Apologies for misleading different record layouts with blocked and unblocked due to my ignorance.

I need to do dynamic allocation because of different layouts in the file. i need to create the number of files based on the number of record layouts, which i cannot create thru jcl. there can be any number,

i require only variable unblocked, as it is used by another jcl for which it is using variable unblocked file. VB is also fine, but the record length i need to code is where i'm facing the problem.

from a link i found that we can use,

The following attributes can be specified in any order after
the DSN keyword:

NEW, OLD, SHR, or MOD
TRACKS or CYL
SPACE(n,m)
VOL(volser)
UNIT(type)
KEEP, DELETE, CATALOG, or UNCATALOG
STORCLAS(storageclass)
MGMTCLAS(managementclass)
DATACLAS(dataclass)

I got the info from following link: www-304.ibm.com/support/docview.wss?uid=isg1PK74015

but i did not get info how to include the recfm and lrecl options. by default its creating VB file with max length of 255. minimum requirement for me is to code LRECL option with different maximum length.

Please share some info on this,

Thanks,
Anjum
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Tue Jul 12, 2011 6:39 pm
Reply with quote

Not judging your design (others can have fun with that), if you are doing a dataset for each layout, then won't each be fixed length (F or FB)?

And why is the "other" JCL using unblocked?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Jul 12, 2011 7:17 pm
Reply with quote

Whilst dynamic allocation of files is pretty trivial, you may encounter difficulties with those files being undeclared in your source module, and therefore generating compile-time errors if you compile with RULES(NOLAXDCL) (and if your production code is compiled with RULES(LAXDCL), I don't think that I want to know your shop).

As I am willing to rush in where Mr. Phrzby declines to go, I really think that you have to re-think your design, especially since your downstream job sounds like it is severely analysis-challenged.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Tue Jul 12, 2011 7:21 pm
Reply with quote

I think that
Quote:
analysis-challenged
is a most polite description. I expect that other contributors will not be so timid.
Back to top
View user's profile Send private message
anjumraza

New User


Joined: 21 Nov 2007
Posts: 17
Location: bangalore

PostPosted: Tue Jul 12, 2011 7:52 pm
Reply with quote

hi,

whether is F or FB or V or VB, i need to include LRECL which is not allowed. is this a limitation? or is there any way?

thanks,
Anjum
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Jul 12, 2011 8:20 pm
Reply with quote

anjumraza wrote:
whether is F or FB or V or VB, i need to include LRECL which is not allowed. is this a limitation? or is there any way?

Reviewing this thread, I am 90% sure that you are misusing terminology.

Assume a statically allocated file. You would of course have a DD statement for it, which would look something like:
Code:
//FOO      DD   DSN=BAR,DISP=(NEW,CATLG,DELETE),etc.

The file is FOO; the data set is BAR. Now, which are you trying to allocate?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Tue Jul 12, 2011 8:54 pm
Reply with quote

Akatsukami wrote:
The file is FOO; the data set is BAR. Now, which are you trying to allocate?
LOL- good choice of words for illustration. I'm afraid if the kid comes back! icon_smile.gif
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Jul 12, 2011 8:59 pm
Reply with quote

Anuj Dhawan wrote:
Akatsukami wrote:
The file is FOO; the data set is BAR. Now, which are you trying to allocate?
LOL- good choice of words for illustration. I'm afraid if the kid comes back! icon_smile.gif

I read a lot of Ed Yourdon in my youth icon_smile.gif
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 -> PL/I & Assembler Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top