IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

get spaces in output dataset


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Mon Jan 30, 2012 9:25 pm
Reply with quote

Hi,

I am running a SQL query to pull 10 character field into a 80 LRECL dataset. It is populating 10 characters perfectly but filling rest of 70 length with low-values. I am using SORT to get rid of those low-values. Can I achieve it with SQL itself to fill rest of 70 length with spaces instead of low-values?

Please help.

Thanks.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jan 30, 2012 9:38 pm
Reply with quote

well, until you tell us exactly what you are doing,
we can not offer you any solutions,
and you are stuck with your sort solution - which should not be necessary.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Jan 30, 2012 9:40 pm
Reply with quote

What language is your query embedded in? That program is IMHO the proper place to edit the output record, not SQL or *SORT.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Jan 31, 2012 11:59 am
Reply with quote

Hi Ramsri...

Modify this query according to your needs...

Code:

SELECT SUBSTR(CHAR('COLUMN WHICH YOU WANT TO UNLOAD')||CHAR(' ',80),1,80)
FROM SYSIBM.SYSDUMMY1
WITH UR;
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jan 31, 2012 1:18 pm
Reply with quote

If you absolutely have no use for the remaining 70 bytes then why dont you set the record length as 10
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Jan 31, 2012 6:07 pm
Reply with quote

gylbharat, my field does not reside on SYSIBM.SYSDUMMY1 table but in a different table.

I am asked to use a 80 byte dataset but just (low-values) should not appear after first 10 bytes is the requirement.

Thanks.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jan 31, 2012 6:14 pm
Reply with quote

ramsri wrote:
gylbharat, my field does not reside on SYSIBM.SYSDUMMY1 table but in a different table.
.



It would be really difficult to change the table name to the correct one.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jan 31, 2012 6:30 pm
Reply with quote

ramsri,

if this a SPUFI select?, is this an unload? is this imbedded SQL?

until you tell us which process you are using to generate the output,
you will get nothing but silly answers, as the above post prove.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jan 31, 2012 7:48 pm
Reply with quote

gylbharat wrote:
Hi Ramsri...

Modify this query according to your needs...

Code:

SELECT SUBSTR(CHAR('COLUMN WHICH YOU WANT TO UNLOAD')||CHAR(' ',80),1,80)
FROM SYSIBM.SYSDUMMY1
WITH UR;


GYLBHARAT

Code:

SELECT CHAR(COLUMN NAME,80) FROM TABLE


should be a better I guess the above function doesnt work for version less than 8

Experts please correct me if am wrong
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jan 31, 2012 7:55 pm
Reply with quote

gylbharat wrote:
Hi Ramsri...
Modify this query according to your needs...

ramsri wrote:
gylbharat, my field does not reside on SYSIBM.SYSDUMMY1 table but in a different table.

Ramsri, you have one guess as to which part need modification!
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Wed Feb 01, 2012 1:17 pm
Reply with quote

ramsri wrote:
gylbharat, my field does not reside on SYSIBM.SYSDUMMY1 table but in a different table.

I am asked to use a 80 byte dataset but just (low-values) should not appear after first 10 bytes is the requirement.

Thanks.


Hi...

You just need to change the table name and the column name...
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Feb 09, 2012 12:06 am
Reply with quote

Hi gylbharat,

I have used the solution you've suggested and got the expected results. Can you please explain how it works.....

Thanks.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
Search our Forums:

Back to Top