Page 1 of 1

How to initialize string in REXX

PostPosted: Mon Mar 28, 2011 7:38 pm
by Mann_B
Hi

How can we intialize a string in REXX
We have to create an o/p file of length 1500 ,n depending upon the i/p records we are processing the records and for few records the length is not up to 1500.When we are concating the reuired var in the o/p file can we add spaces to the rest of the length.

Eg:
1200 Spaces(till 1500)
12 001234 ........................... .........................

and also ...the last spaces shud be like ..spaces(14 bytes) and lowvalues (2bytes)..again spaces(14 bytes) lwvallues(2bytes)...till 1500 length

stringout = string1 || spaces

where spaces = spaces(14 bytes) and lowvalues (2bytes)..again spaces(14 bytes) lwvallues(2bytes)...till 1500 length

PLs let me know if any one of you have any idea

I tried giving like this,

DO LEN1 = (LENGTH(STRING2) + 1) TO 1500
STRING2 = (STRING2,LEN1,"40")
STRING2 = (STRING2,LEN2,"0000")
LEN1 = LEN1 + 14
LEN2 = LEN2 + 14
END
QUEUE STRING2
COUNT4=QUEUED()

But it is throwing error
73 +++ STRING2 = (STRING2,LEN1,"40")
Error running EXPBK2, line 73: Unexpected "," or ")"
Please help me out in intializing this string...

Re: How to initialize string in REXX

PostPosted: Mon Mar 28, 2011 8:24 pm
by enrico-sorichetti
STRING2 = (STRING2,LEN1,"40")
STRING2 = (STRING2,LEN2,"0000")

REXX complains because it does not understand what You are trying to tell
the syntax is not one for a correct assignment!

no need for a DO loop
read the REXX manuals for the COPIES builtin

Re: How to initialize string in REXX

PostPosted: Mon Mar 28, 2011 10:02 pm
by Pedro
STRING2 = (STRING2,LEN1,"40")
STRING2 = (STRING2,LEN2,"0000")

Yeah, it is not clear what you are trying to do there. Perhaps missing a function name.

I suggest you learn how to use the LEFT( ) function.

Re: How to initialize string in REXX

PostPosted: Wed Apr 06, 2011 12:30 pm
by Steve Coalbran
This doesn't much look like REXX to me. What model card punch do you have? ;-)

If you want to assign a string you just do so...
astring = value

if u need it to be 1500 long then say
astring = LEFT(value,1500)

so what u could do is...
astring = LEFT("",1500)

and then overlay the fields at the offsets you require?
astring = OVERLAY(block,astring,12,100)
astring = OVERLAY(clump,astring,256,10)

does that answer it?

Re: How to initialize string in REXX

PostPosted: Tue Apr 26, 2011 12:47 pm
by Mann_B
HI

Thank You ..for you reply

We got the required o/p.

We have calculated the length till we got the vaid messages,and then for rest of the length till the EOF,we have updated with the required fillers.