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

Dynamically create flat file in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
hnharish

New User


Joined: 30 Aug 2005
Posts: 23

PostPosted: Mon Sep 26, 2011 11:43 am
Reply with quote

Hello All,

Could you please provide me a sample code to create flat file dynamically in REXX.

Thanks,
Harish.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Sep 26, 2011 11:45 am
Reply with quote

No.

I leave it to you to search the forum
and even google,
to find the answer.
Back to top
View user's profile Send private message
hnharish

New User


Joined: 30 Aug 2005
Posts: 23

PostPosted: Mon Sep 26, 2011 12:08 pm
Reply with quote

Hello,

I have already done searching for sample code in google and found the below code but it is not creating file.

ALLOCDS:
FILENAME = "ABC.FEP."||PGMNAME||".SEQ"
"ALLOCATE DATASET('"FILENAME"') NEW SPACE(5,1) DSORG(PS) RECFM(F)",
"LRECL(80) BLKSIZE(800)"
IF RC > 0 THEN DO
SAY "ERROR " RC " FAILURE TO ALLOCATE DATASET " FILENAME
EXIT 8
END
RETURN

Thanks,
Harish
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 Sep 26, 2011 12:15 pm
Reply with quote

So what happens when you run the code? Do you get any messages? What does the message say? How about running the code with the trace on?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Mon Sep 26, 2011 12:18 pm
Reply with quote

The allocated command specified above,
Code:
"ALLOCATE DATASET('"FILENAME"') NEW SPACE(5,1) DSORG(PS) RECFM(F)",
"LRECL(80) BLKSIZE(800)"

works fine. Exact error message would be useful in helping you find a solution than "but it is not creating file. "
Back to top
View user's profile Send private message
Stefan

Active User


Joined: 12 Jan 2006
Posts: 110
Location: Germany

PostPosted: Mon Sep 26, 2011 12:37 pm
Reply with quote

The sample you provided is absolutely correct.
Creating a flat file means two things:
    - Use the NEW parameter on the ALLOC statement together with all necessary data set attributes
    - Use PS as data set organization

What went wrong when you run the program?
Post your full code together with the output to let somebody check what had happened.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Sep 26, 2011 12:44 pm
Reply with quote

I just got curious and run a simple tests...
looks like TSO allocate is buggy ...
it should not let allocate with recfm F (fixed) and mismatching lrecl-blksize
the first thing to do would be to change RECFM(F) to RECFM(F B)

it allocates it... it allocates it, but it will be unusable
when trying to edit it ISPF fails reporting a lrecl/blksize mismatch for F format datasets

i thought initially about commenting ...
the manuals has the answer ... starting from here
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/IKJ4BK90
not the latest ones but more than enough to solve this simple problem
if You are lazy or unable to find the relevant pages here is the direct link to the relevant pages
for the manual
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4C590/CCONTENTS?SHELF=IKJ4BK90&DN=SA22-7782-10&DT=20080523031459
for the allocate command
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4C590/1.7?SHELF=IKJ4BK90&DT=20080523031459

but, since it looks like the TS is providing completely wrong info
the only advice is to look better to what is happening
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Sep 26, 2011 1:24 pm
Reply with quote

Follow on ...
the situation is a bit murky
some investigation has to be done
i' ll post in a while the results
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Mon Sep 26, 2011 1:29 pm
Reply with quote

Quote:

RECFM(F) LRECL(80) BLKSIZE(800)


I guess it has to be : RECFM(F B)
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Sep 26, 2011 1:55 pm
Reply with quote

as i said the situation is very murky

I was tempted to post as my first comment ...
You dummy , NEW ok but after that aren' t You missing something,
by I was in a wisdom moment and ...
the manual tells
Quote:
If you specify a data set name, a NEW data set is kept and cataloged. If you do not specify a data set name, it is deleted when you free it or log off.


but that holds only when using the TSO allocate
when using the BPXWDYN interface, things behave in a different way ,
the dataset gets delete afterwards
also I noticed that using TSO allocate the datasets gets allocated to a STORAGE volume
when using BPXWDYIN it gets allocated to a PUBLIC volume

anyway it is always better to use all the logic parameters and not let them default

and remember, when using BPXWDYN the KEYWORDS AND THE SYNTAX ARE <DIFFERENT> from the tso ALLOC
Back to top
View user's profile Send private message
hnharish

New User


Joined: 30 Aug 2005
Posts: 23

PostPosted: Mon Sep 26, 2011 2:35 pm
Reply with quote

Hello,

I am using the pgm PGM=IRXJCL, that is the reason the file is not getting created.

Could you please tell me how to create the file using the above program.

Thanks,
Harish
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Sep 26, 2011 2:41 pm
Reply with quote

Quote:
I am using the pgm PGM=IRXJCL, that is the reason the file is not getting created.


for what effing reason why didn ' t You post that info from the beginning instead of having people wasting time to test and research to help You ?

do You have a doctor' s prescription to use irxjcl !

search the forums and read the manuals
no reason for anybody to waste time on badly asked questions icon_evil.gif

and above all learn how to post properly
to make the most out of the questions You ask and to forecast the comments You might receive
it would be wise for You to read and meditate on
how to ask questions the smart way
here catb.org/~esr/faqs/smart-questions.html
or .. for a more PC language
here support.microsoft.com/kb/555375
Back to top
View user's profile Send private message
hnharish

New User


Joined: 30 Aug 2005
Posts: 23

PostPosted: Mon Sep 26, 2011 4:49 pm
Reply with quote

enrico-sorichetti wrote:
Quote:
I am using the pgm PGM=IRXJCL, that is the reason the file is not getting created.


for what effing reason why didn ' t You post that info from the beginning instead of having people wasting time to test and research to help You ?

do You have a doctor' s prescription to use irxjcl !

search the forums and read the manuals
no reason for anybody to waste time on badly asked questions icon_evil.gif

and above all learn how to post properly
to make the most out of the questions You ask and to forecast the comments You might receive
it would be wise for You to read and meditate on
how to ask questions the smart way
here catb.org/~esr/faqs/smart-questions.html
or .. for a more PC language
here support.microsoft.com/kb/555375


I am not a REXX expert. I am still in a learning stage. I was doing some more research on the above issue and came to know that the above code does not work with irxjcl pgm.I have implemented most of the REXX code with irxjcl pgm hence thought the above code will also work.

I have some questions to you.
Why didn't this question came into u r mind?
You would have asked this question to me earlier itself.right?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Sep 26, 2011 4:52 pm
Reply with quote

Quote:
I have some questions to you.
Why didn't this question came into u r mind?
You would have asked this question to me earlier itself.right?


as usual like spoiled kids who expect everything and giving nothing
You are just trying to blame me for Your incompetence
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Sep 26, 2011 4:55 pm
Reply with quote

oh boy, the politically correct stand tall.

the fault aways lies with someone else.

hnharish,

how much help do you think you are going to receive now?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Sep 26, 2011 5:02 pm
Reply with quote

Hi Dick,
in this case it' my usual dumbness that made think about people having done a bitsy bit of homework and due diligence in telling

for the TS
the usual assumption is that the REXX has been run under IKJEFTxx so it is Your duty to tell otherwise from the beginning if it is not so
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Mon Sep 26, 2011 6:46 pm
Reply with quote

hnharish wrote:
I am not a REXX expert. I am still in a learning stage.

You are not an expert in anything, Sunny Jim, else you'd know that ALLOCATE is a TSO command, not a Rexx statement or function, and that IKJEFTxx is background TSO, whilst IRXJCL is the Rexx batch interpreter.

I see that you've been a member of this site for six years, but claim no mainframe skills. That, to my mind, is entirely correct icon_razz.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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top