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

Sql query to get the position


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

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Aug 20, 2009 5:09 pm
Reply with quote

Hi
I have query issue as below,

From the sysibm.syscolumns table, I want to find the starting position for each column in DCLGEN. I will illustrate the problem as below.

Seq no Length

1 5
2 3
3 7
4 8


i want to get the position using the following logic


seq no Length Position
1 5 1
2 3 Length of Seq no 1 + 1
3 7 Length of Seq no 1 + Length of Seq no 2 + 1
4 8 Length of Seq no 1 + Length of Seq no 2 + Length of Seq no 3 + 1


I want to do this thru the query, can some one guideme how this can be achieved.

Regards
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Aug 20, 2009 5:14 pm
Reply with quote

I would suggest that it is a useless effort icon_biggrin.gif
even if the DCLgen process builds a record like layout,
DB2 has no concepto of record, just of atomic fields COLUMNS

so it might be a concern the lenght of each column/field,
but the offset/position does not really make sense
as I said from a DB2 perspective
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Aug 20, 2009 5:24 pm
Reply with quote

thanks for the quick response,
i want to use the length and position to move the values in the dclgen. Bit cryptic, but this is how the things are at this shop.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Aug 20, 2009 5:29 pm
Reply with quote

Quote:
Bit cryptic, but this is how the things are at this shop.


simply stupid icon_biggrin.gif

but since that is how they di things they should already have devised a standard approch for the issue
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Aug 20, 2009 9:01 pm
Reply with quote

but lets the i have the req for a any other table, and i want to keep adding the column lenght for all the previous values, how thru join or nested query i can achieve it
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Aug 20, 2009 9:11 pm
Reply with quote

use the same approach used for the already existing tables,
since the practice is established there should be no need to ask a forum
just follow the standards of Your organization

if You do not know.... ask Your peers, they should

it' s unreasonable to ask people outside Your organization to help implement a silly solution
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 21, 2009 2:38 am
Reply with quote

Hello,

Once again, i'm late to the party. . . .

How are these lengths/displacements used? Will this be used perhaps to create Easytrieve layouts?

Suggest that if you are determined to automate this (rather than do it manually as it probably is now), you would be ahead to write a bit of code rather than try to write a single query or some convoluted join.

If you are going to use the values to create Easytrieve layouts, there is a feature that will convert a cobol layout to Easytrieve. If you have Easytrieve you could use the convert to generate the info you want even if it was not for use with Easytrieve. . .
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Fri Aug 21, 2009 3:26 am
Reply with quote

Quote:
Once again, i'm late to the party. . . .
Go back home and get your party hat on... Oh, never mind, I see you already have it on. icon_lol.gif
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
Search our Forums:

Back to Top