Thanks for the solution... that works great!
I actually thought about trying this, but I wasn't sure if I could pass one structure followed by a different structure.
(I typically use DATA-GEN with YAJLDTAGEN)



-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Scott Klement
Sent: Thursday, February 29, 2024 1:25 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Re: CSVGEN?

This definitely belongs in the RPG forum.  It's a question about how to do something in RPG...


To add column headings, just write a record containing the column
headings...   Example follows:


**free
dcl-fPRODP disk;
dcl-dsprodrec likerec(PROD:*INPUT) inz;
dcl-dsheadings qualified;
col1  varchar(50) inz('Prod ID');
col2  varchar(50) inz('Product Name');
col3  varchar(50) inz('Description');
col4  varchar(50) inz('Price');
col5  varchar(50) inz('Image ID');
col6  varchar(50) inz('Stock Qty');
col7  varchar(50) inz('Cat1');
col8  varchar(50) inz('Cat2');
col9  varchar(50) inz('Cat3');
col10 varchar(50) inz('Spec');
end-ds;
setll*startPRODP;
readPRODP PRODREC;
data-gen *START %DATA( 'product list.csv':'doc=file')
                 %GEN('CSVGEN');
data-gen HEADINGS %DATA( 'product list.csv'
:'doc=file output=continue')
                  %GEN('CSVGEN');
downot%eof(PRODP);
data-gen PRODREC %DATA( 'product list.csv'
:'doc=file output=continue')
                    %GEN('CSVGEN');
readPRODP PRODREC;
enddo;
data-gen *END  %DATA( 'product list.csv':'doc=file')
                 %GEN('CSVGEN');
*inlr= *on;


On 2/28/2024 1:10 PM, Greg Wilburn wrote:
Maybe this belongs in RPG forum?

I'm currently experimenting with Scott's CSVGEN using DATA-GEN, but I'm not sure how to get column headings using this method.

I was hoping it worked like YAJLDTAGEN that uses the DS names.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.