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
 

 

Issue in Alloating a file in REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Divakar R

New User


Joined: 19 Feb 2013
Posts: 9
Location: India

PostPosted: Thu Apr 04, 2013 3:23 pm    Post subject: Issue in Alloating a file in REXX
Reply with quote

We have
Quote:
Out.0=670 records (79 rec len)

"ALLOCATE DD(BR01) NEW SPACE(25) CYLINDERS" ,
"DSORG(PS) LRECL(15004) RECFM(V B)"
"EXECIO * DISKW BR01 (STEM out. FINIS"

"EXECIO * DISKR BR01 (STEM tem. FINIS"
say out.0 ....
Quote:
Displaying 670 count

say tem.0 ...
Quote:
Getting count as 0


Do a=1 to out.0 by 1
say tem.a
Quote:
..displaying "tem.1....tem.670"

End
Back to top
View user's profile Send private message

mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu Apr 04, 2013 3:39 pm    Post subject:
Reply with quote

Please re-read it. You forgot to ask what to do with your post...you have just outlined what you have done and not what is going wrong.You have not asked any questions.
Back to top
View user's profile Send private message
Divakar R

New User


Joined: 19 Feb 2013
Posts: 9
Location: India

PostPosted: Thu Apr 04, 2013 3:42 pm    Post subject:
Reply with quote

Hi,
Thanks for ur reply.

I need to copy the dats from out.0 to BR01 file.. Which is not happening..

For confirmation.. /I juz moved the BR01 data into tem. and displaying it.
As output, I'm getting tem.1
tem.2
tem.3
....
tem.670

Kindly advise how to allocate a file/ how to move data into new file/ how to daiplay the dta from new file..
Back to top
View user's profile Send private message
Divakar R

New User


Joined: 19 Feb 2013
Posts: 9
Location: India

PostPosted: Thu Apr 04, 2013 3:48 pm    Post subject:
Reply with quote

How to debug RExx programs..?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Apr 04, 2013 3:52 pm    Post subject:
Reply with quote

Use TRACE I
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Thu Apr 04, 2013 3:53 pm    Post subject: Reply to: Issue in Alloating a file in REXX
Reply with quote

Mainly I look at the code, and go through it, see what I've done that is stupid. Else, have a look at Trace in Rexx. When posting problems with Rexx code, always do a Trace, look at it, and only if you still don't get it, post here, including the results of the Trace, please.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Apr 04, 2013 3:54 pm    Post subject: Reply to: Issue in Alloating a file in REXX
Reply with quote

first of all read here why using
EXECIO * DISKW is a bad practice
http://www.ibmmainframes.com/viewtopic.php?t=60269&highlight=execio

and here is a TESTED snippet which allocates, writes, reads without any problems

Code:
/*REXX */
Trace "O"
dsname = "'ENRICO.TEST.MF1'"
aparm  = "SPACE(1 1) TRACKS UNIT(SYSDA) " || ,
         "DSORG(PS) RECFM(F B) LRECL(80) " || ,
         "NEW CATALOG "

del_0ms = msg("OFF")
Address TSO "DELETE "dsname
del_0rc = rc

zrc =  $alloc("DDNAME", dsname, aparm)
say "after the ALLOC  RC("zrc")"
if  zrc \= 0 then do
    say "alloc error for file" dsname
    exit
end

xou.0 = sourceline()
do i = 1 to xou.0
   xou.i = sourceline(i)
end

zrc =  $tsoex("EXECIO" xou.0 "DISKW DDNAME (STEM XOU. FINIS")
say "after the DISKW  RC("zrc")"
if  zrc \= 0 then do
    say "EXECIO error for file" dsname
    exit
end
drop xou.

zrc =  $tsoex("EXECIO" "*"    "DISKR DDNAME (STEM XIN. FINIS")
say "after the DISKR  RC("zrc")"
if  zrc \= 0 then do
    say "EXECIO error for file" dsname
    exit
end

say left(xin.0,4)
do i = 1 to xin.0
   say left(i,4) "-" strip(xin.i, "T")
end

zrc =  $free("DDNAME")
say "after the FREE   RC("zrc")"

del_0ms = msg("OFF")
Address TSO "DELETE "dsname
del_0rc = rc

Exit 0

/* */
novalue:
say  "*********************************"
say  "**                             **"
say  "** novalue trapped at line" || right(sigl,4) || " **"
say  "**                             **"
say  "*********************************"
exit

/* */
$tsoex:
   tso_0tr = trace("O")
   Address TSO arg(1)
   tso_0rc = rc
   trace value(tso_0tr)
   return tso_0rc
/* */
$alloc:procedure
   alc_0tr = trace("O")
   parse upper arg ddnm, dsnm, misc
   ddnm = strip(ddnm)
   dsnm = strip(dsnm)
   dsnm = strip(dsnm,,"'")
   dsnm = "DA('"dsnm"') "
   misc = space(misc)
   alc_0ms = msg("OFF")
   Address TSO "FREE  FI("ddnm") "
   Address TSO "ALLOC FI("ddnm") " dsnm misc
   alc_0rc = rc
   z = msg(alc_0ms)
   trace value(alc_0tr)
   Return alc_0rc
/* */
$free:procedure
   alc_0tr = trace("O")
   parse upper arg ddnm
   ddnm = strip(ddnm)
   alc_0ms = msg("OFF")
   Address TSO "FREE  DD("ddnm") "
   alc_0rc = rc
   z = msg(alc_0ms)
   trace value(alc_0tr)
   Return alc_0rc
Back to top
View user's profile Send private message
Divakar R

New User


Joined: 19 Feb 2013
Posts: 9
Location: India

PostPosted: Thu Apr 04, 2013 7:35 pm    Post subject:
Reply with quote

Existing program.. (reclength= 90)

Code:
brfile.i = "BR" || Right(i,2,"0")                     
"ALLOCATE DD("||brfile.i||") NEW SPACE(25) CYLINDERS" ,
         "DSORG(PS) LRECL(15004) RECFM(V B)"                 
"EXECIO * DISKW "||brfile.i||" (STEM out. FINIS"       
"EXECIO * DISKR "||brfile.i||" (STEM abc. FINIS"       
say out.0                                               
say abc.0                                             
say brfile.i                                           
                                                       
Do a=1 to abc.0 by 1                                   
say abc.a                                             
End       


Quote:
Output
Code:
12           
12           
BR01         
 DATE         
--------------
 2013-04-04   
 2013-04-04   
 2013-04-04   
 2013-04-04   
 2013-04-04   
 2013-04-04   
--------------
             
             
--------------



New Program.. (where reclength = 79 )
Code:
brfile.i = "BR" || Right(i,2,"0")                                 
"ALLOCATE DD("||brfile.i||") NEW SPACE(25) CYLINDERS" ,
         "DSORG(PS) LRECL(15004) RECFM(V B)"     
"EXECIO * DISKW "||brfile.i||" (STEM out. FINIS"       
"EXECIO * DISKR "||brfile.i||" (STEM abc. FINIS"       
say out.0                                             
say abc.0                                             
say brfile.i                                           
brrcnt.i = o                                           
                                                       
Do a=1 to out.0 by 1                                   
say abc.a                                             
End                                                    [quote]Output[/quote]
669
0
BR01
ABC.1
ABC.2
ABC.3
ABC.4
ABC.5
ABC.6
ABC.7
ABC.8
ABC.9
ABC.10
Back to top
View user's profile Send private message
Divakar R

New User


Joined: 19 Feb 2013
Posts: 9
Location: India

PostPosted: Thu Apr 04, 2013 7:38 pm    Post subject:
Reply with quote

I'm unable to understand the reason, Why the new program which was coded as existing.. Is producing diff output..

Can anyone please advise me. How to procedd with this kind of scenario.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Apr 04, 2013 7:39 pm    Post subject: Reply to: Issue in Alloating a file in REXX
Reply with quote

the info posted was/is completely useless.
post the whole REXX script

Reread and try to understand my previous script that works
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Apr 04, 2013 7:50 pm    Post subject: Reply to: Issue in Alloating a file in REXX
Reply with quote

what are the 90 an 79 lrecls ?
Back to top
View user's profile Send private message
Divakar R

New User


Joined: 19 Feb 2013
Posts: 9
Location: India

PostPosted: Thu Apr 04, 2013 8:15 pm    Post subject:
Reply with quote

Hi Enrico,

Sorry, I'm unable to understand your script. I'm beginner in Rexx. Moreover I'm doing this as part of new develeopment. which needs to be moved into production, and should run daily. I'm executing this program thru JCL.

Kindly advise, what is difference between the above 2 samples..
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Thu Apr 04, 2013 8:35 pm    Post subject:
Reply with quote

Divakar R wrote:
Hi Enrico,

Sorry, I'm unable to understand your script. I'm beginner in Rexx. Moreover I'm doing this as part of new develeopment. which needs to be moved into production, and should run daily.

Wow. icon_eek.gif

You don't know Rexx, you have no support or training, and your moron of a boss says, "Hey, kusomushi, write this program chop-chop; we need it for production". I'm glad that I don't work for that sorry outfit.

Enough of this deserved sarcasm, though. Put a trace statement ("TRACE I") at the beginning of your script. Post the output for the lines that you have shown here, in Code tags.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Apr 04, 2013 9:42 pm    Post subject: Reply to: Issue in Alloating a file in REXX
Reply with quote

My scripts do not seem that much complicated
unless for complicated You mean the presence of the proper checking of the return codes

what is that You do not understand when I told post the whole script ? icon_evil.gif

did You care to read the topics where I explain why it is plain wrong to use
EXECIO * DISKW
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

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 What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 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


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