|
From: | Michael Anderson |
Subject: | Re: [open-cobol-list] opening variable named files programatically |
Date: | Sun, 23 Jun 2013 18:42:14 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
Sounds like you need something like:
SELECT optional TargetFile ASSIGN To dynamic my-filename FILE STATUS IS File-STATUS ORGANIZATION LINE SEQUENTIAL. Then, in working storage: 01 File-STATUS Pic xx value "00". 01 my-filename Pic x(68) value spaces. And in the procedure division: Move "/dir1/dir2/somefile.extension" to my-filename. Then open the file. How you come with the files names is totally up to you. On Linux I might call "system" with a command like: ls /dir1/dir2/ > /tmp/filelist Then read all file names from this tmp file, count them, and load them into a table of "OCCURS DEPENDING ON" count. You might choose another method to get file names into your program. -- Mike. On 06/23/2013 01:11 PM, Patrick wrote: Hi Everyone I haven't posted for a month of more but I am plugging away with open Cobol every minute I can and loving it. I have hit a roadblock, actually two, though I am creating a program to help my son with his apraxia. He has a terrible time sequencing sounds. I believe that the English language is complicating his issues. There is a very poor mapping of sounds to the written the language and he is very visual. I have spent quite some time making a respelling system for him. It is based on IPA. The international phonetic alphabet writes how words should be spoken. For instance fox in IPA is fɒks. There are too many characters in IPA to teach my son and there are too many similar characters which could confuse regular spelling. I have been trying to create a respelling system that is based on 44 sightwords I will teach him. I want him to be able to say parts of words. So for instance, the A in face is different then the A in cat. Rather then using complex characters I want to print cat and face with the "A" highlighted and the rest of the word in lowlight, the whole word itself will become the special linguistic "character". I have created 25000 files that look like this file named fox fɒks Fish hOt Kick Sink I want to read through the file line by line and call procedures to print sightwords stacked in such a way that they look like a vertical cross word puzzle word. His respelling system will be written vertically. The F in fish will be directly over the O in hot, the K in kick and the S in sink. f O K S will all be in the same color and the rest of the letters will be dim. The first line will not be printed, it's the IPA transcription and is there so I can error check. I don't think it will be so hard to do this once I figure out how to open the files but right now I am stuck. My first problem is being able to open files not hardcoded in the FD section. I haven't come across any examples of this. When he(or I) type in "lime" in an entry field, I want libcob to search through 25K files to open the correct one on the fly. and without any hardcoding. I don't know how to do this. I don't want to have to have my cobol executable mixed in with 25K other files too. I can't seem to figure out how to open a file by it's full Linux path name. I found this thread: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1358&forum=1&viewmode=flat&order=ASC&start=10 and found Brian's suggestion and did this: export LD_RUN_PATH=/cob/lookup (I made a cob directory after root to keep the path name short) if I echo $LD_RUN_PATH I get the correct results. I have hardcoded a file named "food" for now into the program but it is not yet being found, I get error 35. Could anyone point me to some more resources so I can read about how to do these two things? Thanks for reading-Patrick ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ open-cobol-list mailing list address@hidden https://lists.sourceforge.net/lists/listinfo/open-cobol-list |
[Prev in Thread] | Current Thread | [Next in Thread] |