From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22076 invoked by alias); 13 Oct 2018 16:23:20 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 22067 invoked by uid 89); 13 Oct 2018 16:23:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=straight, terminate, CSV, represented X-HELO: mtaout006-public.msg.strl.va.charter.net Received: from mtaout006-public.msg.strl.va.charter.net (HELO mtaout006-public.msg.strl.va.charter.net) (68.114.190.31) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 13 Oct 2018 16:23:17 +0000 Received: from impout006 ([68.114.189.21]) by mtaout006.msg.strl.va.charter.net (InterMail vM.9.00.023.01 201-2473-194) with ESMTP id <20181013162315.WBIW7358.mtaout006.msg.strl.va.charter.net@impout006>; Sat, 13 Oct 2018 11:23:15 -0500 Received: from [192.168.1.6] ([66.191.41.128]) by impout006 with charter.net id n4PF1y0022lujD6014PFRG; Sat, 13 Oct 2018 11:23:15 -0500 X-Auth-id: anZkZWxpc2xlQGNoYXJ0ZXIubmV0 Subject: Re: read CSV data consistently from string or file To: "Browning, Robert S IV ERDC-RDE-GSL-MS CIV" , "fortran@gcc.gnu.org" References: <10B680D9-A65E-4B86-9F7C-760184201DAB@contoso.com> <0A2AF1BD-224D-4EC7-BD4C-52CEBBDAF1AF@erdc.dren.mil> <80D3D374-24CC-4283-BDDC-6355F0E05AC6@erdc.dren.mil> <10d458a1-d2e6-fd1e-abc0-0126f03d0271@charter.net> From: Jerry DeLisle Message-ID: <6cdf9426-2c5b-bb4d-99e3-677239fcb451@charter.net> Date: Sat, 13 Oct 2018 16:23:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <10d458a1-d2e6-fd1e-abc0-0126f03d0271@charter.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00058.txt.bz2 On 10/12/18 4:52 PM, Jerry DeLisle wrote: > On 10/12/18 1:10 PM, Browning, Robert S IV ERDC-RDE-GSL-MS CIV wrote: >> I am needing to read in a text file that contains numerical data >> separated by keywords. Because of the keywords, I need to read each >> line in as text first and test if it’s a keyword, and then call the >> appropriate subroutine based on the keyword value. Within the >> subroutines I also need to read each line as text first so I can stop >> the subroutine when the next keyword is found. >> The numerical data can be in either fixed format or >> comma-separated-value (CSV) format. In the CSV data, a zero could be >> represented by a pair of commas with no number between them. >> The issue I have encountered is that the read statement appears to >> behave differently when it is reading from a character string than >> when it is reading directly from the input file. If I were able to >> read directly from the input file, then a simple formatted read >> statement does everything I need. But if I am reading from a string, >> then things get a bit more complicated. > > Hi Robert, > > This may be a known bug. It sounds familiar. Let me do some checking. > > Fortranners, if I confirm this is the bug I think it is, I think I can > squeeze some time to fix it. > > Jerry > I am fairly certain this is PR78351. As far as we can tell the code is non-conforming Fortran but the use of comma to terminate a read has been around forever and gfortran supported this before. It was my breakage in my endeavors to improve string I/O performance. I feel obligated at this point to set it straight. Jerry