View previous topic :: View next topic
|
Author |
Message |
Anand Kumar
New User
Joined: 29 Aug 2007 Posts: 24 Location: chennai
|
|
|
|
Hi,
Through REXX I am creating some insert queries. I store the data in an array and write into the output file.
The output dataset created looks like this:-
Code: |
INSERT INTO GBX.OVST8801 (
ID,
DAT
) VALUES (
'OM01', --ID
'2005-03-17'); --DAT
INSERT INTO GBX.OVST8801 (
ID,
DAT
) VALUES (
'OM02', --ID
'2010-10-17'); --DAT
INSERT INTO GBX.OVST8801 (
ID,
DAT
) VALUES (
'OM03', --ID
'2010-10-24'); --DAT |
I would look nice if the data is alligned like below. i.e. data from "--" should move to 35th position. Data truncation after 72 is no problem because it is any way a comment.
Code: |
INSERT INTO GBX.OVST8801 (
ID,
DAT
) VALUES (
'OM01', --ID
'2005-03-17'); --DAT
INSERT INTO GBX.OVST8801 (
ID,
DAT
) VALUES (
'OM02', --ID
'2010-10-17'); --DAT
INSERT INTO GBX.OVST8801 (
ID,
DAT
) VALUES (
'OM03', --ID
'2010-10-24'); --DAT |
Please let me know if there is any way to do this alignment in REXX itself.
Thanks,
Anand[/code] |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Are you using the OVERLAY function? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Anand Kumar wrote: |
Please let me know if there is any way to do this alignment in REXX itself. |
Yes, there is. Simply infix the desired number of spaces. I recommend the use of a recursive function to get that string; you'll find use for it in many other situations. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I'd go for OVERLAY too |
|
Back to top |
|
|
Anand Kumar
New User
Joined: 29 Aug 2007 Posts: 24 Location: chennai
|
|
|
|
Okey, I will use Overlay itself. We are trying to make this dynamically created. Hence we never know how many spaces each line to suffix or rather it would go more complex.
Thank you. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
Quote: |
Please let me know if there is any way to do this alignment in REXX itself. |
Show us how you are doing it now. Show us your rexx.
Consider using the LEFT(stuff,35) function. |
|
Back to top |
|
|
|