|
Hello Joel ! Thanks for the reply. I wanted to list the field names horizontally with commas so as to past them in an SQL statement instead of typing the field names. I know we could use Select * but if we want a selective list then it becomes a bit tedious. It is easier to delete rather than type. This brings me to the next suggestion/request to help all those who use SQL (including you). If you could create a utility to generate the SELECT & INSERT clauses for a Library/File which could be pasted directly into SEU/Code400 it would save a whole lot of time. What I'm trying now is : DSPLY VERFKY,VECOD4,VEPYTM,VECUST,VERECP,VEDL08,VETXPC,V DSPLY ECOM1,VECOM2,VEDES1,VEDES2,VEINTL,VENAME,VEDL80,VE DSPLY NTL,VENAME,VEDL80,VEPER1,VEPER2,VED800,VED801,VED8 DSPLY RECP,VEDL08,VETXPC,VECOM1,VECOM2,VEDES1,VEDES2,VEI What I'm suggesting is: C+ SELECT FROM Library/File C+ VERFKY,VECOD4,VEPYTM,VECUST,VERECP,VEDL08,VETXPC, C+ VECOM1,VECOM2,VEDES1,VEDES2,VEINTL,VENAME,VEDL80, C+ VENTL,VENAME,VEDL80,VEPER1,VEPER2,VED800,VED801, C+ VED8RECP,VEDL08,VETXPC,VECOM1,VECOM2,VEDES1,VEDES2 C+ INSERT INTO Library/File C+ (VERFKY(10A),VECOD4(2A),VEPYTM(4A),VECUST(12S0),VERECP(11S2),VEDL08(4A),VETXPC(4S2), C+ VECOM1(12S0),VECOM2(12S0),VEDES1(12S0),VEDES2(12S0),VEINTL(12S0) ,VENAME(12S0),VEDL80(12S0), C+ VENTL(12S0),VENAME(12S0),VEDL80(12S0),VEPER1(12S0),VEPER2(12S0) ,VED800(12S0),VED801(12S0), C+ VED8RECP(12S0),VEDL08(12S0),VETXPC(12S0),VECOM1(12S0),VECOM2 (12S0),VEDES1(12S0),VEDES2(12S0)) We could directly copy & paste the SELECT statement & delete the unwanted fields. The INSERT statement have got the field type & size so that we could add any required constants of that type/size. Thanks for the 'getTokens' procedure too, I don't require it right now but I'm sure I'll need it some time or the other & I would not know how to use it. I'm not sure if I'll be able to use all your other goodies on the site too. If you remember I had asked for some examples also to be posted on your site for each procedure - I guess it is asking for too much. If by chance you have some examples stored as a ready reckoner somewhere in one of your PC/AS400, I'd love to have them. This is just a suggestion/request. You have already done a fantastic job with the other Service Programs so I won't complain. Thanks a million too for adding the 'week ' procedures in your current update. Thanks once again & keep up the good work Best regards Ewart To: RPGNext Discussion and Information <rpgnext@xxxxxxxxxxxx> Joel Cochran <jrc@xxxxxxxxxx> cc: Sent by: rpgnext-bounces@xxxxxxxxxxxx 2004/09/29 07:28 PM Please respond to RPGNext Discussion Subject: and Information Re: [RPGNext] Display Field list of a file On Fri, 2004-09-24 at 07:32, Ewart Desouza wrote: > > > Hello Joel ! > > I would like to create a command using the quslfld_getFieldNameList() > procedure or the RNBQUSLFLD service program to display the fields of a file > on the screen so that I could cut & paste them in my RPG program using SQL. > How should I go about it ?? > > Sorry if this is a trivial question but I don't see the input parameters in > quslfld_getFieldNameList() and I don't see any documentation on the service > program RNBQUSLFLD. The documentation for RNBQUSLFLD is on the website at: http://www.rpgnext.com/docs/rnbquslfld/ > I'm pasting the code which I am testing to no success. > > Thanks & best regards > Ewart > > H DFTACTGRP(*NO) > /copy rpgnextlib/qrpglesrc,cp_hspecs > /copy rpgnextlib/qrpglesrc,cp_longprs > /copy rpgnextlib/qrpglesrc,cp_uslfld > > D fldlst S 32000a varying > D count S 5s 0 > D dspstr S 30a > > C *entry plist > C parm prfile 10 > C parm prlibrary 10 > > *---> The idea is to retreive the field list of the file entered > through the parameter and display 30 characters at a time on screen OK, the first thing you have to do is initialize the service prgoram to reference this file: C callp quslfld_initialize( prfile:prlibrary) Now the rest of the procedures in the service program will refer to the file passed in. > C eval fldlst = quslfld_getFieldNameList() The return string is comma delimited, so you need to parse it out to retrieve the field names. The easiest way to do this is with the "getTokens()" procedure. Add these D-Specs first: d fieldArray s 100a dim(999) varying d fieldCount s 10i 0 inz Then call the procedure to populate the arrays: C eval fieldCount = getTokens( fieldList : %addr( fieldArray ) : ',' ) > C eval count = 1 Now try a FOR loop instead to process the list of fields: C For count=1 to fieldCount ; C eval dspstr = fieldArray( count ) > C dspstr Dsply C EndFor > C Eval *INLR = *On Let me know if this helps, Joel http://www.rpgnext.com _______________________________________________ This is the RPGNext Discussion and Information (RPGNext) mailing list To post a message email: RPGNext@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpgnext or email: RPGNext-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpgnext.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.