× 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.



Ron

CL is not the best language for working with files - it has always been kludgy, and this is just an example. I'm not even sure it is solved with allowing more than one DCLF in more recent releases. So to get this done in a single program, do it the right way - JAVA!! Just kidding - RPG. Do the CPYSPLF in the CLLE module, then read the file in an RPGLE module - use CALLPRC - very easy - and use CRTPGM to link the 2 modules into one program - then you have your "single program" solution.

HTH
Vern

Ron Hudson wrote:
The workaround leads me back to my first problem. If I do not hit end of file, the file remains locked and I cannot overlay it with the next spool file. The CLOF command does not seem to release the file as I would expect it to. When EOF is reached, the copy of the next splf does work properly. Pseudo code below. I know there is the option of splitting it into 2 programs, but seems to me it should work within 1.


WRKSPLF to *print

Copy splf to FILE1


Loop1

RCVF FILE1

Copy splf to FILE2

Loop2

RCVF FILE2

QCLSCAN for string

If string found

Delete splf

CLOF FILE2

Goto Loop1

Else

Goto Loop2

CLOF FILE2

Goto Loop1


To: midrange-l@xxxxxxxxxxxx
From: wayne.mcalpine@xxxxxxxxxxxxxxxxx
Subject: Re: CLOF & POSDBF issue
Date: Thu, 10 Sep 2009 16:07:39 -0500

There is a workaround for this problem. You can do a RTVMBRD and get the number of records in the file. Knowing that, you can read the file in a DOFOR group and avoid hitting the end of file. It can then be repositioned and read a second time.

DeLong, Eric wrote:
I think you may need to create a second CL program to do the file2
processing. I think that hitting eof in a rcvf loop in CL cannot be
reset.
-Eric

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Ron Hudson
Sent: Tuesday, September 08, 2009 2:18 PM
To: midrange-l@xxxxxxxxxxxx
Subject: CLOF & POSDBF issue




I have a CL program which does a WRKSPLF to an outfile, then copies the
outfile to a PF.



The CL loops thru each record of the first PF, and copies the splf to a
second PF and reads thru this second splf looking for a string. At EOF
on the second PF, or when the string is found, I want to process the
next record in the first PF.


When I find the string:

if I exit the loop, then attempt to copy the next splf to the second
PF, I get an error message the file is locked, even though I've done a
CLOF on the second PF.

if I continue reading to EOF, I can copy the next splf to the second
PF, but I'm stilled positioned at the EOF. POSDBF is not positioning to
the beginnign of the file.



Is there any way around this situation.



I've searched the archives, found where this has been posted before but
not a solution. I do see reference to Scott having an explanation to
this but I cannot find his explanation.





Thanks

Ron

_________________________________________________________________
With Windows Live, you can organize, edit, and share your photos.
http://www.windowslive.com/Desktop/PhotoGallery
--
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.


_________________________________________________________________
Get back to school stuff for them and cashback for you.
http://www.bing.com/cashback?form=MSHYCB&publ=WLHMTAG&crea=TEXT_MSHYCB_BackToSchool_Cashback_BTSCashback_1x1

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.