While all-pipes solutions are usually elegant and always inherently cool, either Bob's or the Piper's could be a challenge to build dynamically. I'd probably use one or the other - or something similar - for a fixed case, but I think Shimon's search for a generalized solution would be more easily addressed by a Rexx stage and wouldn't suffer that much of a performance penalty.
-- Mike Harding CMSTSO Pipelines Discussion List <CMS-PIPELINES@VM.MARIST.EDU> wrote on 08/25/2009 07:40:44 AM: > From: Bob Cronin <bob.cro...@gmail.com> > To: CMS-PIPELINES@VM.MARIST.EDU > Date: 08/25/2009 07:41 AM > Subject: Re: reversing *parts* of a record > Sent by: CMSTSO Pipelines Discussion List <CMS-PIPELINES@VM.MARIST.EDU> > > Couldn't you use Specs to do this? Assign those parts of the record > that need to be reversed to a variable and use "print reverse(var)" to > build the output record? > > For example > > PIPE Strliteral /abcdefg 12345 hijklmn 6789/ > | Specs a: w1 . b: w3 . print reverse(a) 1 w2 nw print reverse(b) nw w4 nw > | Console > > produces: > > gfedcba 12345 nmlkjih 6789 > -- > bc > > On Tue, Aug 25, 2009 at 7:17 AM, John P. Hartmann<jphartm...@gmail.com> wrote: > > 3WAY gets you one range of a record. You'll need two, the second on > > the tertiary output from the first. > > > > |w1: 3way w4 > > |g1: gather > > \w1: > > |reverse > > |g1: > > \w1: > > |w2: 3way w-2 > > |g1: > > \w2: > > |reverse > > |g1: > > \w2: > > |g1: > > > > j. > > > > 2009/8/25 Shimon Lebowitz <shimon...@gmail.com>: > >> I am trying to deal with a problem apparently created for me by > Mr. Gates & Co. > >> > >> I need to send files from CMS to end users on PCs, where the > >> files contain data which represents Hebrew characters. I gave > >> SMTP a translation table which converts the EBCDIC representation > >> of Hebrew to the ASCII used by Windows, but the PC is a smart alec, > >> and also reverses the character order, since Hebrew reads right to left. > >> > >> So, if I have input records like this on CMS: > >> > >> 2008 12987 65084 abcdefgh 78346 45239 tuvwxyz 873468 > >> 2009 31 836 ijklmno 169827 8373 mnop 34902 > >> > >> (Note: the letters in the actual record will be Hebrew! I only used > >> English to prevent the confusion that happens when the order gets > >> reversed. And besides, how many of you have Hebrew fonts?). > >> > >> If I SendFile a file of those records to a MS-Win system, > >> the characters will be displayed on the screen as hgfedcba, zyxwvut, > >> etc. In order to have the data normal when it arrives, I need > >> to reverse the field which contains the Hebrew text, but obviously NOT > >> the other parts of the record, which would destroy the numeric values. > >> > >> What I think would be my favorite solution would be for the REVERSE > >> stage to accept inputranges, as the XLATE stage does. That would be great! > >> A simple ... | REVERSE 22-31 48-56 | ... would solve my problem > >> easily and elegantly. But... REVERSE has no ranges. :-( > >> > >> Since the EXEC I am writing must deal with many different > >> files, and will receive external arguments defining the positions > >> of the Hebrew fields, I need a generalized solution. I tried something > >> with a particular case, where I knew the positions (only one > >> Hebrew field 5-24) and the record length (fixed 32): > >> ... > >> 'F1: FANOUT |', > >> 'F2: FANINANY |', > >> 'JOIN 1 |', > >> 'SPECS 1-32 1 33-* 5 |', > >> '>' OUTPUTID, > >> '? F1: |', > >> 'SPECS 5-24 1 |', > >> 'REVERSE |', > >> 'F2:' > >> > >> How would I generalize this? And is there a better way? > >> > >> Thanks! > >> Shimon > >> > >