OpenCOBOL Forum Index OpenCOBOL
select fname clause, Variable value as filename | Register To Post |
| Threaded | Newest First | Previous Topic | Next Topic | Bottom |
| Poster | Thread |
|---|---|
| shaj | Posted on: 2010/2/3 16:30 |
Just popping in ![]() ![]() Joined: 2010/2/3 From: Posts: 4 |
select fname clause, Variable value as filename Does OpenCOBOL supports this usage ?
SELECT FILE fname .... USING WS-FILE-NAME WS-FILE-NAME is a working storage variable that can be populated at runtime. |
| jgt | Posted on: 2010/2/3 16:45 |
Not too shy to talk ![]() ![]() Joined: 2010/1/18 From: 44.21.48N 80.50.15W Posts: 26 |
Re: select fname clause, Variable value as filename Yes it does.
You can do: SELECT PRINT-FILE ASSIGN TO "$SPOOL/PRINTFILE" where SPOOL is an environment name: SPOOL=./spool/$LOGNAME; export SPOOL then the print file will be ./spool/user/PRINTFILE also SELECT CUST ASSIGN TO WS-FILE-NAME 01 WS-FILE-NAME. 03 FILLER PIC X(4) VALUE 'CUST'. 03 WS-COMPANY-NUMBER PIC XX. 03 WS-FILLER PIC X(4) VALUE '.DAT'. MOVE '01' TO WS-COMPANY-NUMBER OPEN CUST Jack |
| wmklein | Posted on: 2010/2/3 22:59 |
Home away from home ![]() ![]() Joined: 2008/12/27 From: Posts: 239 |
Re: select fname clause, Variable value as filename The last reply was (sort-of) non-responsive. The reply tells you how you can use a "dynamic file name" but it does NOT answer the asked quesion of whether OC does or does not support the current ANSI/ISO Standard
syntax. I am not certain whether OC does or doesn't support this (standard) syntax, but I think that is the question in this thread. |
| rkeane | Posted on: 2010/2/4 1:16 |
Just popping in ![]() ![]() Joined: 2006/3/26 From: St Petersburg, FL Posts: 9 |
Re: select fname clause, Variable value as filename I've just tried a "Select xxx USING data-name" and received:Error: syntax error, unexpected USING, expecting SEQUENTIAL
|
| human | Posted on: 2010/2/4 7:30 |
Home away from home ![]() ![]() Joined: 2007/5/15 From: Posts: 958 |
Re: select fname clause, Variable value as filename If I understood it right the current draft says that these are the different possibilities with SELECT USING:
Do I read this right? All rules for USING seem to be "Implementor-definied" and I found nothing about SELECT xxx ASSIGN [yyy] USING data-name in MF docs... BTW: It's interesting that the commonly used version I see this as a FR to support SELECT xxx ASSIGN [yyy] USING. human |
| wmklein | Posted on: 2010/2/4 23:23 |
Home away from home ![]() ![]() Joined: 2008/12/27 From: Posts: 239 |
Re: select fname clause, Variable value as filename You are correct that the reserverd word "ASSING" is required before USING data-name. (I had forgotten that).
As for the "commoon" ASSIGN data-name extension, it actually is NOT identically implemented by all vendors that have this extension. In some cases, if you have ASSIGN xyz, the compiler and ruh-time will look for "xyz" as a data name first. In other cases they will look for an "environment variable" xyz first, and in still other cases they will look first for "external stuff" like JCL. That is why the Standard explictly added ASSIGN USING so that the compiler would ALWAYS look for a data-name with the value of the file name. |
| human | Posted on: 2010/2/5 7:41 |
Home away from home ![]() ![]() Joined: 2007/5/15 From: Posts: 958 |
Re: select fname clause, Variable value as filename Quote:
What does the following usage mean? Here is a patch for the usage This works like a charm, enabling I thought to patch the usage it would suffice to add conflicts: 121 shift/reduce; expected 118 shift/reduce conflicts human |
| btiffin | Posted on: 2010/2/6 13:50 |
Home away from home ![]() ![]() Joined: 2008/6/7 From: CANADA Posts: 755 |
Re: select fname clause, Variable value as filename I've not thought through the implications of your parser change, and it's always deep thinking, even trivial changes, but the first meaningful line of parser.y will be %expect 118. change that to %expect 121 to test your changes.
Shift/Reduce issues in the cobc parser need careful examination. Is it a harmless s/r? Harmless being a state where either a shift OR a reduce would still provide a valid and acceptable semantically correct compile http://dinosaur.compilertools.net/bison/bison_8.html#SEC70 has a pretty good explanation of the s/r issue using the famous 'dangling else' example. Cheers, Brian |
| human | Posted on: 2010/2/7 15:24 |
Home away from home ![]() ![]() Joined: 2007/5/15 From: Posts: 958 |
Re: select fname clause, Variable value as filename Let Roger decide if we increase the expected shift/reduce issues or if he find a better way of implementation.
human |
| shaj | Posted on: 2010/2/26 14:26 |
Just popping in ![]() ![]() Joined: 2010/2/3 From: Posts: 4 |
Re: select fname clause, Variable value as filename We use following syntax on IBM HOST
1. SELECT xxx ASSIGN TO HOSTFNAME HOSTFNAME is set by JCL Following syntax required for IBM COBOL compiler on WINDOWS 2. SELECT xxx ASSIGN [TO] USING PC-VAR here PC-VAR is a variable name which is set with in the program. Following syntax is required for OPEN-COBOL on PC. 3. SELECT xxx ASSING TO PC-VAR And default configuration file-mapping=yes needs to be changed to enable this. |
| Threaded | Newest First | Previous Topic | Next Topic | Top |
| Register To Post | |








