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
 

 

Dynamic file creation in PLI with variable length
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Dynamic file creation in PLI with variable length
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: 7904
Location: Bellevue, IA

PostPosted: Mon Jul 11, 2011 5:45 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Jul 11, 2011 5:57 pm    Post subject: Reply to: Dynamic file creation in PLI with variable length
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Jul 11, 2011 7:06 pm    Post subject: Reply to: Dynamic file creation in PLI with variable length
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Jul 11, 2011 7:33 pm    Post subject: Reply to: Dynamic file creation in PLI with variable length
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

Active Member


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

PostPosted: Mon Jul 11, 2011 8:03 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Jul 11, 2011 9:44 pm    Post subject: Reply to: Dynamic file creation in PLI with variable length
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

Active Member


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

PostPosted: Mon Jul 11, 2011 9:54 pm    Post subject:
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 11, 2011 10:04 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Jul 11, 2011 10:08 pm    Post subject:
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: 7904
Location: Bellevue, IA

PostPosted: Mon Jul 11, 2011 10:53 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Jul 11, 2011 11:32 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Jul 12, 2011 12:06 am    Post subject:
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: 1712
Location: UK

PostPosted: Tue Jul 12, 2011 12:21 am    Post subject:
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    Post subject:
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: https://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

Active Member


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

PostPosted: Tue Jul 12, 2011 6:39 pm    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Tue Jul 12, 2011 7:17 pm    Post subject:
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler 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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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