Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Will this code extract 1 byte from file using rexx?

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

Active User


Joined: 15 Dec 2005
Posts: 261

PostPosted: Sat Nov 10, 2018 11:13 pm    Post subject: Will this code extract 1 byte from file using rexx?
Reply with quote

Dear all

Please validate whether the below piece of code will extract 1 byte f rtom file using rexx

Code:

"EXECIO * DISKR MYINDD (FINIS STEM MYVAR"
DO i = 1 to MYVAR0
   this_line = VALUE('MYVAR'||i)
END"

Do i = 1 to myvar.n /* to get the record */
   If i< myvar.n then
   Do
      Do j = 1 to 500
         X=substr(myvar.n,1,i) /* to get the 1 byte of record*/
      End
   End
End


code reformatted to give decent indentation
Back to top
View user's profile Send private message

steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 727
Location: The Universe

PostPosted: Sun Nov 11, 2018 12:15 am    Post subject:
Reply with quote

What happened when you ran it?
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10584
Location: italy

PostPosted: Sun Nov 11, 2018 3:05 am    Post subject:
Reply with quote

the code snippet You posted does not make any sense

try with

Code:
"EXECIO * DISKR MYINDD (FINIS STEM MYVAR."

pos = 1
do i = 1 to myvar.0
    say "line" i ", pos" pos "'"substr(myvar.i,pos,1)"'"
end
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 420
Location: Maryland

PostPosted: Sun Nov 11, 2018 5:50 am    Post subject:
Reply with quote

In order to extract one byte, there is absolutely no need to read all records. Especially when file size can be 100,000,000 records. Especially doing this senseless activity in one shot, into single stem (in the memory!!!)
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10584
Location: italy

PostPosted: Sun Nov 11, 2018 5:58 am    Post subject: Reply to: Will this code extract 1 byte from file using rexx?
Reply with quote

from the number of do statements it seemed clear that the TS wanted to extract 1 byte from each record...

I am really tired of talking about good practices, when most people do not care about them.
if I feel in the mood I provide some hints, otherwise I just ignore the topic
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 261

PostPosted: Sun Nov 11, 2018 7:13 am    Post subject:
Reply with quote

Enrico is right. Need to extract 1byte from each record.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2161
Location: UK

PostPosted: Sun Nov 11, 2018 1:38 pm    Post subject: Reply to: Will this code extract 1 byte from file using rexx?
Reply with quote

Why do you need someone to verify it your code? Why can you not do it yourself? A simple test data set (not file) with one record and LRECL of 10, for example, would show if your code worked or not.

How many records in your input data set? And LRECL?
Back to top
View user's profile Send private message
enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10584
Location: italy

PostPosted: Sun Nov 11, 2018 3:31 pm    Post subject: Reply to: Will this code extract 1 byte from file using rexx?
Reply with quote

no reformatting will make a bad snippet good icon_cool.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2161
Location: UK

PostPosted: Sun Nov 11, 2018 8:00 pm    Post subject: Reply to: Will this code extract 1 byte from file using rexx?
Reply with quote

Quote:
no reformatting will make a bad snippet good

True - but it makes it easier to see how bad it is.
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 How can I close a flat file in Ezytrieve dibyendumandal11111 CA Products 3 Wed Apr 17, 2019 2:19 pm
No new posts POSITIONING THE CURSOR USING REXX MJ SHARATH CLIST & REXX 6 Tue Apr 09, 2019 10:27 am
No new posts Pipe Delimited File to xpand thesumitk COBOL Programming 15 Tue Apr 02, 2019 1:02 pm
No new posts Split input file into multiple files ... srini24 DFSORT/ICETOOL 1 Sat Mar 30, 2019 9:39 pm
No new posts Attachmate file transfer question John Poulakos All Other Mainframe Topics 3 Wed Mar 20, 2019 1:45 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us