How to initialize string in REXX



IBM's Command List programming language & Restructured Extended Executor

How to initialize string in REXX

Postby Mann_B » Mon Mar 28, 2011 7:38 pm

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...
Mann_B
 
Posts: 79
Joined: Wed Mar 31, 2010 11:48 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to initialize string in REXX

Postby enrico-sorichetti » Mon Mar 28, 2011 8:24 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: How to initialize string in REXX

Postby Pedro » Mon Mar 28, 2011 10:02 pm

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.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: How to initialize string in REXX

Postby Steve Coalbran » Wed Apr 06, 2011 12:30 pm

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?
Steve
User avatar
Steve Coalbran
 
Posts: 138
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 13 times
Been thanked: 1 time

Re: How to initialize string in REXX

Postby Mann_B » Tue Apr 26, 2011 12:47 pm

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.
Mann_B
 
Posts: 79
Joined: Wed Mar 31, 2010 11:48 am
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post