Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sql query to get the position

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Sql query to get the position
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Thu Aug 20, 2009 5:14 pm    Post subject: Reply to: Query
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    Post subject: Reply to: Query
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Thu Aug 20, 2009 5:29 pm    Post subject: Reply to: Query
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Thu Aug 20, 2009 9:11 pm    Post subject: Reply to: Query
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

Site Director


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

PostPosted: Fri Aug 21, 2009 2:38 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us