Re: PDS Processing in REXX
In !!AAAYAAQ4RJd0XGpDr15Py/7fTtTCgAAAEGa3JORyE7NLh9i+JZqm994BAA==@btconnect.com, on 03/28/2013 at 08:49 AM, Terry Sambrooks terry_sambro...@btconnect.com said: The single quotes are there to inhibit TSO prefix, They don't, because they are REXX delimiters rather than part of the value. The issue with file processing is how much data is being processed. One thing for certain is that EXECIO 1 is the most inefficient method as the EXECIO code will be entered for each and every record. That's due to the way that he coded it, not due to EXECIO. Use the STEM option if you want to speed it up. That said z/VM REXX provides two I/O processing methods one using EXECIO and the other using stream commands like ooREXX. The ANSI stream I/O is what you would use in classic REXX; it is only in OOREXX for compatibility. The norm for OOREXX is the stream class F3 = 'SUPPORT.FILE.PDS(FDQKVS)' Stream1 = .stream~new(F3) do while Stream1~lines() WS_INB = Stream1~linein() SAY LEFT(WS_INB,79) end -- Shmuel (Seymour J.) Metz, SysProg and JOAT Atid/2http://patriot.net/~shmuel We don't care. We don't have to care, we're Congress. (S877: The Shut up and Eat Your spam act of 2003) -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: PDS processing in REXX
Kenneth, lady and gentlemen,. I do thankyou for your responses. There was much there that I have put to use, SYSDSN, apostrophes, DELETE, use of EXECIO *, Got most of the coding done, now to wait for mainframe access (hopefully IBM VIC), getting a good lesson in 'proper'.REXX. Lizette, here in general what it has to do .. The REXX accepts two parms. The first is a four letter word e.g. HOBB and must match 1-4 of a record in the flat file SUPPORT.PDS(ZY4LW). The second is the path/name of a copybook e.g.PUBMAST.CPYBKS.PROD(AGM002), must be checked for existence, if exists then is then read to extract some info. Next is to prepare are three empty PDS's being: SYSUID.HOBB SYSUID.HOBB.BMS SYSUID.HOBB.JOBS If they exist they MUST be deleted (empty or not)(deleting is necessary, not REUSE). Then ALLOCATE'd and thus created. Then into SYSUID.HOBB must be copied the copybook (the second parm), also three known flat files. Then churn out a msg to the user on the Option 6 screen that their environment has been built and they may submit the next job (another REXX) which will do stuff with the second/third PDS's. That's it, works fine on my laptop. cheers, thanks again. Graham - Original Message - From: Kenneth Klein (TEMA TPC) kenneth.kl...@tema.toyota.com Newsgroups: bit.listserv.ibm-main To: IBM-MAIN@LISTSERV.UA.EDU Sent: Thursday, March 28, 2013 9:26 AM Subject: Re: PDS processing in REXX The I/O routines in mainframe REXX and ooRexx on an intel chip must be different for many inherent reasons. We're talking records and blocks on the mainframe and byte streams on the PC for one thing. Here is a working example of a rexx exec I run in a batch job. The files are allocated in the JCL so that part will not help you unless you choose that option. I just wanted to show you how to use an array to hold all your data from the file without loading and running the execio code in a loop. In this code you read the file once, and write the output file in one operation. The writing is done using the REXX QUEUE, another very powerful feature of REXX. /* REXX */ trace r ADDRESS TSO EXECIO * DISKR INDD (STEM lineread. FINIS) IF RC ^= 0 THEN do SAY 'THERE IS A PROBLEM WITH YOUR DATASET.' rc EXIT END SAY lineread.0 'RECORDS READ FROM input file' outline = system_id = s_id interval_date = date interval_time = time total_dispatch_time_CP1A = cp1a total_dispatch_time_CP1C = cp1c total_dispatch_time_CP1D = cp1d total_dispatch_time_CP1F = cp1f total_dispatch_time_CP1H = cp1h total_dispatch_time_CP1K = cp1k total_dispatch_time_CP1L = cp1l total_dispatch_time_CP1S = cp1s total_dispatch_time_CP1U = cp1u total_dispatch_time_CP1Z = cp1z outline =, system_id || , , interval_date || , || interval_time || , ||, total_dispatch_time_CP1A || , ||, total_dispatch_time_CP1C || , ||, total_dispatch_time_CP1D || , ||, total_dispatch_time_CP1F || , ||, total_dispatch_time_CP1H || , ||, total_dispatch_time_CP1K || , ||, total_dispatch_time_CP1L || , ||, total_dispatch_time_CP1S || , ||, total_dispatch_time_CP1U || , ||, total_dispatch_time_CP1Z /* end of building the outline. */ queue outline outline = DO I = 1 TO LINEREAD.0 select WHEN substr(LINEREAD.I,48,26) = 'P A R T I T I O N D A T A' , system_id \= 's_id' then do outline =, system_id || , , interval_date || , || interval_time || , ||, total_dispatch_time_CP1A || , ||, total_dispatch_time_CP1C || , ||, total_dispatch_time_CP1D || , ||, total_dispatch_time_CP1F || , ||, total_dispatch_time_CP1H || , ||, total_dispatch_time_CP1K || , ||, total_dispatch_time_CP1L || , ||, total_dispatch_time_CP1S || , ||, total_dispatch_time_CP1U || , ||, total_dispatch_time_CP1Z /* end of building the outline. */ queue outline outline = end /* do */ WHEN SUBSTR(LINEREAD.I,6,14) = 'PARTITION NAME' THEN system_id = substr(lineread.i,40,4) when SUBSTR(LINEREAD.I,64,7) = ' DATE ' THEN interval_date = substr(lineread.i,71,10) when SUBSTR(LINEREAD.I,64,7) = ' TIME ' THEN interval_time = substr(lineread.i,71,8) when substr(LINEREAD.I,2,4) = 'CP1Z' THEN total_dispatch_time_CP1Z = substr(lineread.i,58,12) when substr(LINEREAD.I,2,4) = 'CP1A' THEN total_dispatch_time_CP1A = substr(lineread.i,58,12) when substr(LINEREAD.I,2,4) = 'CP1C' THEN total_dispatch_time_CP1C = substr(lineread.i,58,12) when substr(LINEREAD.I,2,4) = 'CP1D' THEN total_dispatch_time_CP1D = substr(lineread.i,58,12) when substr(LINEREAD.I,2,4) = 'CP1F
Re: PDS processing in REXX
Graham Hobbs wrote: 1. create a new PDS if it's not there Use SYSDSN(DSN) to check if a dataset is still there or not. For example, I create a temporary dataset for work using an unique name: DO FOREVER DSN=USERID().TEMPSUBSTR(TIME(),4,2)SUBSTR(TIME(),7,2) IF SYSDSN(DSN) /= 'OK' THEN LEAVE END ALLOC DA(DSN) F(INVOER) NEW SPACE(5) CYLINDERS, UNIT(SYSDA) CATALOG LRECL(80) RECFM(F) DSORG(PS) Sorry for answering only one question... Groete / Greetings Elardus Engelbrecht -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
PDS Processing in REXX
Hi Graham, Taking your questions in order: 1 - Deleting a data set PARA1: F1 = 'ENCORE.CBL.SOURCE' DELETE 'F1' /* TRYING TO GET MY HEAD AROUND THESE QUOTE'Y THINGS */ RC_REASON = 'DELETE 'F1; CALL RETCODE RETURN This code, using the TSO DELETE command will do the job without the need to. pre-allocate. The double quotes are there to ensure that the REXX interpreter does not attempt to execute the DELETE command. The single quotes are there to inhibit TSO prefix, which if turned on would prefix the data set name in variable F1 with the prefix held in the TSO PROFILE. I notice that in RETCODE it is RC that is tested no RC_REASON. To be safe it would be better to test RC_REASON in RETCODE in case RC has been changed before arrival. 2 - Allocating the data set As Elardus mentioned I would use the built-in Function SYSDSN to check data set status before attempting the allocate. As far as the allocate goes the ultimate disposition of the data set is missing. With only NEW coded the data set will be created, then deleted. To be kept it would be better to add CATALOG. SYSDSN will provide a textual response which will help understand the state of the data set, i.e. it may be allocated but ENQ'd by another task. 3 - Reading the member The issue with file processing is how much data is being processed. One thing for certain is that EXECIO 1 is the most inefficient method as the EXECIO code will be entered for each and every record. If the member is small then think about EXECIO * which will read all the members in one go, which will avoid the need for the loop, and allow the file to be closed at the same time by the addition of FINIS to the EXECIO options; i.e. EXECIO * DISKR INFILE1 (FINIS Note that EXECIO returns RC = 2 at end-of-file. 4 - I/O Processing differences. It could be argued that I/O processing differences between TSO and ooREXX are a strength rather than a weakness. It is this difference which allows REXX to be so portable. That said z/VM REXX provides two I/O processing methods one using EXECIO and the other using stream commands like ooREXX. Kind Regards - Terry Director KMS-IT Limited 228 Abbeydale Road South Dore Sheffield S17 3LA UK Reg : 3767263 Outgoing e-mails have been scanned, but it is the recipients responsibility to ensure their anti-virus software is up to date. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
PDS processing in REXX
Hello, OK to ask for some help please, or where might I go?:-) Am not a sysprog, hope to be back on a z/OS machine in a short while, have to convert several ooREXX's to mainframe acceptability so, to save some mainframe time $'s, if I may, will ask neophyte questions (have googled); that said .. .. this REXX CJM1 will run from TSO/ISPF Option 6 and is: /* REXX CJM1 */ CALL PARA1 CALL PARA2 CALL PARA3 EXIT /* this needs to delete an empty or non-empty PDS from existence, do I need to allocate etc, or will the following work? */ PARA1: F1 = 'ENCORE.CBL.SOURCE' DELETE 'F1' /* TRYING TO GET MY HEAD AROUND THESE QUOTE'Y THINGS */ RC_REASON = 'DELETE 'F1; CALL RETCODE RETURN /* this needs to 1. create a new PDS if it's not there 2. empty it if it is there */ PARA2: F2 = 'CONRAD.TEST.CPYBKS' ALLOC DA('F2') NEW REUSE RECFM(F B) LRECL(80), DIR(255) SPACE(50,10) TRACKS UNIT(SYSDA) RC_REASON = 'ALLOC I 'F2; CALL RETCODE /* WISE TO FREE THIS FIRST?; IF ALLOC FAILS, CAN I ASSUME FILE NOT THERE */ RETURN /* this needs to read and print a PDS member; is there a 'not so crude' way */ PARA3: F3 = 'SUPPORT.FILE.PDS(FDQKVS)' ALLOC DDNAME(INFILE1) DSN('F3') SHR REUSE RC_REASON = 'ALLOC I 'F3; CALL RETCODE /* WISE TO FREE THIS FIRST?; IF ALLOC FAILS, CAN I ASSUME FILE NOT THERE */ F3_EOF = 'NO' DO WHILE F3_EOF = 'NO' EXECIO 1 DISKR INFILE1 IF RC = 0 THEN DO PULL WS_INB SAY SUBSTR(WS_INB,1,79) END ELSE DO F3_EOF = 'YES' END END EXECIO 0 DISKR INFILE1 (FINIS RC_REASON = 'FINIS 'F3; CALL RETCODE FREE DDNAME(INFILE1) RC_REASON = 'FREE 'F3; CALL RETCODE RETURN RETCODE: IF RC \= 0 THEN DO SAY 'E: 'RC_REASON' PROBLEM'; EXIT END ELSE DO SAY 'I: 'RC_REASON' OK' END RETURN .. thanks in advance, Graham Hobbs PS. Not being 'deep' .. why is I/O coding different between mainframe and ooREXX? Did it have to be? -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN