× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



File that will have the sorted data. Sort is on M2RUN.

What I need is to break the data I am generating in the file right below
into separate data files. So I can then turn them into a TXT file. There is
another processing step that has to be done for the final solution. But an
interim step is to get the separated files downloaded into CSV files. Which
will save the person doing the next processing step manually allot of work.

Hopefully I have better explained the problem.

A R DATA_SW_RC
A*
A M2ON 11S 3
A M2PN 15A
A ML2OQ 9S 3
A ML2SDM 4S 0
A ML2SDY 2S 0
A M2RUN 15A
A PMD1 20A
A PMD3 20A
A PMD4 20A
A PMD7 20A


Data Structure

ddsHold ds
d M2ON 11s 3
d M2PN 15a
d ML2OQ 9s 3
d ML2SDM 4s 0
d ML2SDY 2s 0
d M2RUN 15a
d PMD1 20a
d PMD3 20a
d PMD4 20a
d PMD7 20a


c Exsr main
*
c eval tmpcnt = tmpcnt

c eval *inlr = *on
*
c main begsr
*

c/EXEC SQL
C+ Declare xcursor Cursor For Select
C+ M2ON, M2PN, ML2OQ, ML2SDM, ML2SDY,
C+ M2RUN,PMD1, PMD3, PMD4, PMD7
C+ FROM FRNDTA031.M2P,
C+ FRNDTA031.PMP,
C+ FRNDTA031.MOP
C+ WHERE
C+ M2PN = PMPART AND
C+ M2ON = MOMO AND
C+ ML2WC = '2205' AND
C+ MORDTE = '12/30/2014' AND
C+ ML2FLG = '0'
C+ ORDER BY M2RUN , ML2SQ#
C+
C/END-EXEC


C/EXEC SQL
C+ OPEN xCursor
C/END-EXEC
*
C/EXEC SQL
C+ FETCH xCursor INTO :dshold
C/END-EXEC
/Free
eval tmpcnt= 0;

Dow SQLSTT = '00000' or SQLSTT= '01557';

eval tmpcnt = tmpcnt + 1;

eval q_M2ON = M2ON;
eval q_M2PN = M2PN;
eval q_ML2OQ = ML2OQ;
eval q_ML2SDM = ML2SDM;
eval q_ML2SDY = ML2SDY;
eval q_M2RUN = M2RUN;

eval q_PMD1 = PMD1;
eval q_PMD3 = PMD3;
eval q_PMD4 = PMD4;
eval q_PMD7 = PMD7;

write DATA_SW_RC;
/End-free

C/EXEC SQL
C+ FETCH NEXT FROM xCursor INTO :dshold
C/END-EXEC
C EndDo
C/EXEC SQL
C+ CLOSE xCursor
C/END-EXEC
c
c endsr

On Mon, Jan 5, 2015 at 4:39 PM, Alan Campin <alan0307d@xxxxxxxxx> wrote:

I think we need additional information to understand what you are doing.
Maybe a simple example.

On Mon, Jan 5, 2015 at 3:37 PM, Thomas Burrows <
thomas.burrows.1957@xxxxxxxxx> wrote:

Vern:

Have not used "parameter marker's" yet in my SQL experience. My PF file
is
created from an SQL that I then push each record into a Data Structure
that
looks like the PF. Copy the data over to the file variables from the DS
variables and write the PF record. Thus I am getting the values for the
CSV
file in a PF, but without the "parameter markers".

Looked in my iSeries SQL book on "parameter markers" and the only example
is loading a subfile. Okay if I can figure out how to do the PM thing how
do I go off and make a CSV file each time the marker changes? Then how
do I
go back and read the PF records into the CSV file? Using CPYTOIMPF. Not
sure how we know what records out of the PF file to use.

Basically I am confused.

Thomas

On Mon, Jan 5, 2015 at 4:05 PM, Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx

wrote:

Thomas

Any idea of a quick solution probably involves a vendor product.

This could be done with SQL - you can build the SELECT for the distinct
values from your sort, then walk through them, using another SELECT
with
parameter marker that takes each distinct value. For each distinct
value,
create the CSV.

One trick for the CSV - use SQL to build each CSV row in a PF, then use
CPYTOIMPF to create the IFS file.

Not too ugly, eh?

HTH
Vern


On 1/5/2015 2:56 PM, Thomas Burrows wrote:

Hi:

Is there a quick way to take one file that is sorted and break into
many
files according to the sort value? Then quickly download to a CSV TXT
file.
Know how to do this in general, but each day there will be an unknown
number of individual sort fields. Usually under fifty but could be
maybe
75
to 100.

Hoping for a quick solution than the rather hard solution I am
thinking
of.

Thomas


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.