Re: [CMS-PIPELINES] Not-always-directly-sequential record references in PIPEs
That example of LOOKUP is fascinating! Going to take a bit to digest. After Sir Rob's reply, I managed to hammer out something that works. Perhaps an unbeautiful / inefficient solution, but not sure? Data file (SOMEFILE MAP A) : " *VOLUME: AA1A11 Provologne PEAR Muenster PEAR Mozzerella PEAR *VOLUME: BB2B22 Provologne APPLE Muenster APPLE Mozzerella KIWI *VOLUME: CC3C33 Provologne KIWI Muenster KIWI Cheddar PEAR " (Where, for example: "VOLUME: AA1A11" / Word2 is our Volser. And in its proceeding record set: Word2 is the Subpool (Ex: "PEAR").) Output produced: " Setup Complete. Outputting now: Subpool=APPLE BB2B22 Muenster BB2B22 Provologne Subpool=KIWI BB2B22 Mozzerella CC3C33 Muenster CC3C33 Provologne Subpool=PEAR AA1A11 Mozzerella AA1A11 Muenster AA1A11 Provologne CC3C33 Cheddar Ready ; T=0.01/0.01 11:39:31 " Program source copy WITHOUT comments: " /* */ ADDRESS COMMAND 'PIPE (endchar ?) < SOMEFILE MAP A' , '| A: FIND *VOLUME' , '|SPEC W2 1.7' , '| B: JUXTAPOSE' , '|SPEC W3 1.6 W1 NW.6 W2 NW W4-* NW' , '|SORT' , '| C: CHOP 7', '|STRIP' , '|UNIQUE FIRST' , '|STEM Subpools1.' , '|SPEC W1 1.7' , '| D: JUXTAPOSE COUNT' , '|SPEC ,/, 1 11-16 STRIP N ,., N 1.10 STRIP N ,/, N W2-* N WRITE' , ',/, 1 11-16 STRIP N ,.0/, N 1.10 STRIP N' , '|VARSET', '?A:| B:' , '?C:| D:' SAY "Setup Complete. Outputting now:" DO i=1 FOR Subpools1.0 SAY "Subpool="Subpools1.i 'PIPE STEM 'Subpools1.i'. | CONSOLE' END EXIT " Program source WITH comments: " /* Test / Example program. */ /* Make a report of Subpools, then organized by Volser. */ ADDRESS COMMAND 'PIPE (endchar ?) < SOMEFILE MAP A' , '| A: FIND *VOLUME' , /* Take only '*VOLUME' records. */ '|SPEC W2 1.7' ,/* Keep Volser, fill 7 col. */ '| B: JUXTAPOSE' , /* Prepend Volser to each of its records. */ '|SPEC W3 1.6 W1 NW.6 W2 NW W4-* NW' , /* Subpool in front. */ '|SORT' , /* Sort by Subpool, then Volser. */ '| C: CHOP 7' , /* Let only first 6 char through (Subpool). */ '|STRIP' , /* Cleanup spaces for Subpool recording. */ '|UNIQUE FIRST' , /* Above UNIQUE FIRST does: */ , /* Make sure duplicate Subpool names don't get recorded. */ , /* Make sure JUXTAPOSE COUNT doesn't give all "1". */ , '|STEM Subpools1.' , /* Keep track of the Subpool names. */ '|SPEC W1 1.7' ,/* Make sure fills exactly 6+1 columns. */ '| D: JUXTAPOSE COUNT' , /* Count number of entries in each Subpool. */ '|SPEC ,/, 1 11-16 STRIP N ,., N 1.10 STRIP N ,/, N W2-* N WRITE' , ',/, 1 11-16 STRIP N ,.0/, N 1.10 STRIP N' , /* Above SPEC puts records in proper format for VARSET. EX: */ , /* /APPLE.1/BB2B22 Mozzerella*/ , /* /APPLE.0/1*/ , '|VARSET' , /* Populate numeric STEMs whose names are the Subpools. */ '?A:| B:' ,/* Move Volser-related records. */ '?C:| D:' /* Move Subpool-related records. */ SAY "Setup Complete. Outputting now:" DO i=1 FOR Subpools1.0 SAY "Subpool="Subpools1.i 'PIPE STEM 'Subpools1.i'. | CONSOLE' END EXIT " --Shawn S. -Original Message- From: CMSTSO Pipelines Discussion List [mailto:CMS-PIPELINES@VM.MARIST.EDU] On Behalf Of Rob van der Heij Sent: Thursday, September 22, 2016 5:11 PM To: CMS-PIPELINES@VM.MARIST.EDU Subject: Re: [CMS-PIPELINES] Not-always-directly-sequential record references in PIPEs > Perhaps this would involve one of the more complicated usages of SPEC that > Mike alluded to? No, that works with the COUNT option of JUXTAPOSE, but you'd have to set the .0 entry too (I would probably write the .0 entry with each of them, like this: spec ,/, 1 w6 n ,., n 1.10 strip n ,/, n 11-* n write ,/, 1 w6 n ,.0/, n 1.10 strip n If nothing else, LOOKUP can do the trick, and well worth learning. Almost fit on the command line for me, but made it a REXX filter. The output of this would feed into VARSET. 'callpipe (end \ name SS1.REXX:2)', '\ *: ', '| v:find *VOLUME:', '| spec w2 1 w4 10.5', '| j:juxtapose', '| l:lookup autoadd before count trackcount w6 master detail', '| i:fanin', '| spec ,/, 1 w6 n ,., n 1.10 strip n ,/, n read 1-* n
Re: [CMS-PIPELINES] Not-always-directly-sequential record references in PIPEs
Flipping through the manuals, and testing it, that does seem to be easy enough. But rather than the number of entries per volume (Word1) , prepending the number of entries per subpool (Word6) would require... Well, I imagine after the JUXTAPOSE (so the Volser and Device-type are now part of each record, see below) , there would have to be a SPEC to put the Subpool in front, and then a SORT (so the Subpools are grouped). And that's about as far as I've managed. So, trying to go from: " AA1A11 3390 2 54 55POOLA AA1A11 3390 2 194195 POOLA AA1A11 3390 1 614614 POOLA BB2B22 3390 5001 500 POOLB BB2B22 3390 1651040 1204 POOLB BB2B22 3390 5 1706 1710 POOLB " To: " 1 POOLA AA1A11 3390 2 54 55 2 POOLA AA1A11 3390 2 194195 3 POOLA AA1A11 3390 1 614614 1 POOLB BB2B22 3390 5001 500 2 POOLB BB2B22 3390 1651040 1204 3 POOLB BB2B22 3390 5 1706 1710 " Or just straight to the VARSET compatible format: " /POOLA.1/AA1A11 3390 2 54 55 /POOLA.2/AA1A11 3390 2 194195 /POOLA.3/AA1A11 3390 1 614614 /POOLB.1/BB2B22 3390 5001 500 /POOLB.2/BB2B22 3390 1651040 1204 /POOLB.3/BB2B22 3390 5 1706 1710 " Perhaps this would involve one of the more complicated usages of SPEC that Mike alluded to? --Shawn S. -Original Message- From: CMSTSO Pipelines Discussion List [mailto:CMS-PIPELINES@VM.MARIST.EDU] On Behalf Of Rob van der Heij Sent: Thursday, September 22, 2016 11:32 AM To: CMS-PIPELINES@VM.MARIST.EDU Subject: Re: [CMS-PIPELINES] Not-always-directly-sequential record references in PIPEs > Juxtapose. Beautiful! > > After that bit of processing, I'm left with records containing 6 > space-delineated words. > > Is it even possible to have PIPE append the record into a STEM where the > stem's name is Word6 in the record? Look at VARSET for that. Basically you create records that can set the variables. You might even need the COUNT option of JUXTAPOSE to number the entries per volume... But it is probably much easier to do the rest of your processing in the pipeline as well rather than fill in the REXX variables and loop through them. He says, after writing a single 10 line pipe that re-allocates mini disks on a set of new volumes ;-) Sir Rob the Plumber
Re: [CMS-PIPELINES] Not-always-directly-sequential record references in PIPEs
> Juxtapose. Beautiful! > > After that bit of processing, I'm left with records containing 6 > space-delineated words. > > Is it even possible to have PIPE append the record into a STEM where the > stem's name is Word6 in the record? Look at VARSET for that. Basically you create records that can set the variables. You might even need the COUNT option of JUXTAPOSE to number the entries per volume... But it is probably much easier to do the rest of your processing in the pipeline as well rather than fill in the REXX variables and loop through them. He says, after writing a single 10 line pipe that re-allocates mini disks on a set of new volumes ;-) Sir Rob the Plumber
Re: [CMS-PIPELINES] Not-always-directly-sequential record references in PIPEs
Juxtapose. Beautiful! After that bit of processing, I'm left with records containing 6 space-delineated words. Is it even possible to have PIPE append the record into a STEM where the stem's name is Word6 in the record? --Shawn S. -Original Message- From: CMSTSO Pipelines Discussion List [mailto:CMS-PIPELINES@VM.MARIST.EDU] On Behalf Of Rob van der Heij Sent: Thursday, September 22, 2016 10:04 AM To: CMS-PIPELINES@VM.MARIST.EDU Subject: Re: [CMS-PIPELINES] Not-always-directly-sequential record references in PIPEs The reason your approach did not work is that REXX substitutes the variable before the PIPE command is issued. CMS Pipelines does not know there even was a variable in your program. As Mike points out, JUXTAPOSE is the way to do this with a multi-steam pipe. PIPE (end \) ... | v: find *VOLUME | spec w2 1.6 w4 nw.5 | j: juxtapose | cons \ v: | spec 8-* 1 | j: Rob
Re: [CMS-PIPELINES] Not-always-directly-sequential record references in PIPEs
The reason your approach did not work is that REXX substitutes the variable before the PIPE command is issued. CMS Pipelines does not know there even was a variable in your program. As Mike points out, JUXTAPOSE is the way to do this with a multi-steam pipe. PIPE (end \) ... | v: find *VOLUME | spec w2 1.6 w4 nw.5 | j: juxtapose | cons \ v: | spec 8-* 1 | j: Rob
Re: [CMS-PIPELINES] Not-always-directly-sequential record references in PIPEs
You could code some complicated conditionals and use counters in Specs, but much simpler: look into JUXTAPOSE. -- Mike Harding z/VM System Support /sp CMSTSO Pipelines Discussion Listwrote on 09/22/2016 07:47:03 AM: > From: "Stanislawski, Shawn (National VM Capability)" > To: CMS-PIPELINES@VM.MARIST.EDU > Date: 09/22/2016 07:47 AM > Subject: Not-always-directly-sequential record references in PIPEs > Sent by: CMSTSO Pipelines Discussion List > > I'm sure this has to be a very easy question, but unfortunately I'm > still struggling with it. > > How can I turn this file (Original) : > " > > *VOLUME: AA1A11 TYPE: 3390 UTILIZATION: 99% > > *FREE* 2 54 55 *FREE* POOLA > > *FREE* 2 194195*FREE* POOLA > > *FREE* 1 614614*FREE* POOLA > > *VOLUME: BB2B22 TYPE: 3390 UTILIZATION: 73% > > *FREE* 5001 500*FREE* POOLB > > *FREE* 1651040 1204 *FREE* POOLB > > *FREE* 5 1706 1710 *FREE* POOLB > " > > Into this console output (Result) : > " > > AA1A11 3390 2 54 55POOLA > > AA1A11 3390 2 194195 POOLA > > AA1A11 3390 1 614614 POOLA > > BB2B22 3390 5001 500 POOLB > > BB2B22 3390 1651040 1204 POOLB > > BB2B22 3390 5 1706 1710 POOLB > " > > using PIPEs? > > > I know I can use SPECS to rearrange the data in a single record, so > getting Result columns 3-6 is easy. > > The problem I cannot seem to figure out is how to: > > 1. take the two columns of data from the "*VOLUME:" record then > > 2. prepend that to the front of each "*FREE*" record , > > 3. and when next "*VOLUME:" record encountered then use that > new data to prepend to the next set of records. > > > I was trying: > " > > 'PIPE (endchar ?) < SOMEFILE MAP A' , > > '| A: FIND *VOLUME' , > >'|SPECS W2 1 W4 NW' , > >'|VAR VOLSER1 TRACK' , > > '?A:|COPY' , > >'|COPY' , > >'|SPECS /'VOLSER1'/ 1 1-* nw' , > > '|CONSOLE' > " > ...but it looks like REXX Variable "VOLSER1" is not getting set - > instead the PIPE literally prepends the string "VOLSER1" to the > front of the records. > > > Any ideas? > > > --Shawn S. >