output from hashed file

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

Code: Select all

LIST DICT yourhashedfile
when I do the list.. even the column names (not all) are split (comes half in one line half in other )

Code: Select all

GET.TERM.TYPE
I have used GET.TERM.TYPE and saw that the width is changing from 80 to 132.

But the following are still occuring
a) HashFile1 : split of fields - fields coming in on more than one line

Code: Select all

Natural_Key    Warehouse.    date1.....    date2.....
      30110    DWH           2003-08-06    2003-10-10
                              15:53:20      00:00:00
b) HashFile2 : each field in different row

Code: Select all

Field1. -4927275313 
Field2. Not Applicable 
Field3. 2008-05-06 09:06:40 
Field4. Test1 
Field5. 0 
Field1. -4829300379 
Field2. Not Applicable 
Field3. 2008-03-25 07:38:49 
Field4. Test2 
Field5. 0 
Field1. -4813747248 
Field2. Not Applicable 
Field3. 2008-03-17 10:51:17 
Field4. Test3 
Field5. 0 
Field1. -4702305701 
Field2. Not Applicable 
Field3. 2008-01-30 13:14:42 
Field4. Test4 
Field5. 0
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

Hi all,

Any ideas... I have been reading here and there, but no luck with it.

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, not really. Why not just do this in a Server job and be done with it?
-craig

"You can never have too many knives" -- Logan Nine Fingers
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

Code: Select all

No, not really. Why not just do this in a Server job and be done with it? 
I have to do this on unix. As its not limited to just one hashed file. It has to be generic script. Which will be called by passing arguments
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The "each field on different line", or "vertical format", happens automatically when there are two many fields to fit in the current device width (e.g. 80 or 132).

The "splitting onto multiple lines", or "wrap", occurs because the data are too wide for the field width defined in the file dictionary. Show us the file dictionary listing. Or perhaps because the data themselves contain line feeds or dynamic array delimiters.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

The data doesn't have new line characters. I have checked it.
Last edited by mystuff on Thu May 28, 2009 10:04 am, edited 1 time in total.
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

I made some study and found that we can change the width of all fields to a predetermined value by using

Code: Select all

CONNECT localuv
.w *,<width>
But even when I do that still the truncation/folding occurs [There is no other option allowed ie. to allow for continous display of the row]

Right now I see that the select query is able to display only 70 characters (approx). It doesn't matter increasing the width as it anyway gets folded due to the limit on the display.

Is there a way that I could set this width to maximum? or FORCE for no truncation/folding by any other means


I would be glad if someone could guide me on this. I have been battering here and there for long time :cry:
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you were to use a "LIST" instead of a "SELECT" the previous advice would have helped and you would get more assistance on any other errors. What does "LIST HashOther" or "LIST DICT HashOther" produce?
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

ArndW wrote:If you were to use a "LIST" instead of a "SELECT" the previous advice would have helped and you would get more assistance on any other errors. What does "LIST HashOther" or "LIST DICT HashOther" produce?
I had both LIST and SELECT above... I am repeating them again over here...

I did try to increase the width, but looks like issue is that the terminal is only able to display approx 75 characters.

Will PTERM or UVOUT help by any means. I am looking into it. But not sure if I could find any.
Last edited by mystuff on Thu May 28, 2009 10:05 am, edited 1 time in total.
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

Any tips that I could hunt on?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The total of field widths plus separator space must be less than your device width. Five at 40 equals 200, which is way too many, so you get vertical format. Try this:

Code: Select all

SELECT Field1 FMT '12R', Field2 FMT '15L', Field3 FMT '20R', Field4 FMT '10L', Field5 FMT '10R' FROM HashOther; 
In this query the total of field widths is less than 80, so should come out in horizontal format, one record per line. Please post the result of this query.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

This is the output resulting from the sql query.

Code: Select all

Field1......   Field2.........   Field3..............   Field4....   Field5....

 -4927275313   Not Applicable     2008-05-06 09:06:40   Test1                 0
 -4829300379   Not Applicable     2008-03-25 07:38:49   Test2                 0
 -4813747248   Not Applicable     2008-03-17 10:51:17   Test3                 0
 -4702305701   Not Applicable     2008-01-30 13:14:42   Test4                 0
 -4697551951   Not Applicable     2008-01-28 11:59:47   Test5                 0
 -4672229048   Not Applicable     2008-01-16 06:56:35   Test6                 0
 -4662878666   Not Applicable     2008-01-11 08:34:17   Test7                 0
 -4662809597   Not Applicable     2008-01-11 08:07:52   Test8 - ab            0
                                                        cdefghijkl
                                                        mnopqrstuv
Thanks for the feedback. Over here as you see here is the 8th records gets split although in List Dict its defined as 40 chars(obviously).

As I want this to be generic and should support hashed files which could probably have any plenty of columns with different lengths (worst case scenario lengths replica of a table with largest number of columns/lengths)

For this I tried to

Code: Select all

SET.TERM.TYPE WIDTH 1000
(it works for big numbers :) as well, will look whats the maximum limit of it)

But the PROBLEM again is that there are too many spaces between each field

Code: Select all

>set.term.type width 1000
DEC vt100 terminal (vt100)
>select * from HashOther;
Field1..................................    Field2..................................    Field3..................................    Field4..................................    Field5..................................

-4927275313                                 Not Applicable                              2008-05-06 09:06:40                         Test1                                       0
-4829300379                                 Not Applicable                              2008-03-25 07:38:49                         Test2                                       0
-4813747248                                 Not Applicable                              2008-03-17 10:51:17                         Test3                                       0
-4702305701                                 Not Applicable                              2008-01-30 13:14:42                         Test4                                       0
-4697551951                                 Not Applicable                              2008-01-28 11:59:47                         Test5                                       0
-4672229048                                 Not Applicable                              2008-01-16 06:56:35                         Test6                                       0
-4662878666                                 Not Applicable                              2008-01-11 08:34:17                         Test7                                       0
-4662809597                                 Not Applicable                              2008-01-11 08:07:52                         Test8 - abcdefghijklmnopqrstuv              0
To eliminate the spaces, I thought, lets get column names from LIST.DICT, use them in sql query along with TRIM function, but the column names gets split (irrespective of how large the SET.TERM.TYPE WIDTH xxxx).
Last edited by mystuff on Thu May 28, 2009 10:05 am, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Terminal type widths supported are only 80 and 132 (and, perhaps, 400). 1000 would be ignored and the previous setting used.

You probably need an approach that does not use "terminal" output but, instead, directs output to a file.

Code: Select all

SETPTR 4,1000,20000,0,0,3,BANNER MyOutput,BRIEF
SELECT * FROM HashOther LPTR 4;
This directs output from the query to "printer channel 4" which is configured by the earlier SETPTR command. The BANNER option names the output file, which is in the &HOLD& subdirectory in your project and can therefore be read with any utility/program that you wish.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Add "COL.SPACES 1" to limit the spaces between columns to 1 instead of the default 3.
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

Hi,

Thanks for the response.

I executed similar statement
SETPTR 4,1000,20000,0,0,3,BANNER MyOutput,BRIEF
SELECT * FROM HashOther LPTR 4;
a) But I am not able to cd (change directory) to &HOLD& or read the MyOutput file.
when I execute

Code: Select all

 find . -follow -name HashOther
I get the result

Code: Select all

./&HOLD&/HashOther
i.e. looks like the file is got created
which is in the &HOLD& subdirectory in your project and can therefore be read with any utility/program that you wish.

b) Will this be generated just as an ascii file?
Post Reply