View previous topic :: View next topic
|
Author |
Message |
anjumraza
New User
Joined: 21 Nov 2007 Posts: 17 Location: bangalore
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
anjumraza
New User
Joined: 21 Nov 2007 Posts: 17 Location: bangalore
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
anjumraza
New User
Joined: 21 Nov 2007 Posts: 17 Location: bangalore
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
anjumraza
New User
Joined: 21 Nov 2007 Posts: 17 Location: bangalore
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10889 Location: italy
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Why the heck do you need to do dynamic allocation? Just specify it in your JCL. |
|
Back to top |
|
|
anjumraza
New User
Joined: 21 Nov 2007 Posts: 17 Location: bangalore
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
I think that
Quote: |
analysis-challenged |
is a most polite description. I expect that other contributors will not be so timid. |
|
Back to top |
|
|
anjumraza
New User
Joined: 21 Nov 2007 Posts: 17 Location: bangalore
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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! |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
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! |
I read a lot of Ed Yourdon in my youth |
|
Back to top |
|
|
|