Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Cobol > Re: Validating ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 32 Topic 4115 of 4172
Post > Topic >>

Re: Validating input file

by Alain Reymond <arwebmail@[EMAIL PROTECTED] > May 13, 2008 at 05:15 PM

This is a multi-part message in MIME format.
--------------070908040207020206000407
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit



jeff a écrit :
> On May 13, 10:27 am, Howard Brazee <how...@[EMAIL PROTECTED]
> wrote:
>   
>> On Tue, 13 May 2008 06:37:11 -0700 (PDT), jeff <jmoore...@[EMAIL PROTECTED]
>
>> wrote:
>>
>>     
>>> I have a input rec coming from a customer that is defined as
>>>       
>>> FD  DISCFILE.
>>> 01  DISC-REC               PIC X(129).
>>> 01  DISC-REC2 REDEFINES DISC-REC.
>>>     03  DISC-RECR OCCURS 129  PIC X.
>>>       
>>> It is a comma-delimited file with 16 fields (15 commas). I need to
>>> check and make sure that each line is only 129 characters and I assume
>>> 1 LF. What would be the best way to accomplish this?
>>>       
>> Are you reading an ASCII file from one Windows machine to another
>> Windows machine?
>>     
>
> Unix ascii file
>   
Jeff, if you use line sequential files, you should not have to care 
about the LF. The records will be 129 chars long.
Then, use unstring :
1 my-record.
    2 my-field pic(129) occurs 16.
.....

                   unstring DISC-REC
                       delimited by ";" or "," or x'09'
                       into
                            my-field(01),
                            my-field(02),
                            my-field(03),
                            my-field(04),
                            my-field(05),
                            my-field(06),
                            my-field(07),
                            my-field(08),
                            my-field(09),
                            my-field(10),
                            my-field(11),
                            my-field(12),
                            my-field(13),
                            my-field(14),
                            my-field(15),
                            my-field(16)
                   end-unstring


Regards.

Alain


--------------070908040207020206000407
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
jeff a &eacute;crit&nbsp;:
<blockquote

cite="mid:f0907ddf-24fd-48d4-b115-a223125e8ec6@[EMAIL PROTECTED]
"
 type="cite">
  <pre wrap="">On May 13, 10:27&nbsp;am, Howard Brazee <a
class="moz-txt-link-rfc2396E"
href="mailto:how...@[EMAIL PROTECTED]
">&lt;how...@[EMAIL PROTECTED]
> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">On Tue, 13 May 2008 06:37:11 -0700 (PDT), jeff <a
class="moz-txt-link-rfc2396E"
href="mailto:jmoore...@[EMAIL PROTECTED]
">&lt;jmoore...@[EMAIL PROTECTED]
>
wrote:

    </pre>
    <blockquote type="cite">
      <pre wrap="">I have a input rec coming from a customer that is
defined as
      </pre>
    </blockquote>
    <blockquote type="cite">
      <pre wrap="">FD &nbsp;DISCFILE.
01 &nbsp;DISC-REC &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PIC
X(129).
01 &nbsp;DISC-REC2 REDEFINES DISC-REC.
&nbsp; &nbsp; 03 &nbsp;DISC-RECR OCCURS 129 &nbsp;PIC X.
      </pre>
    </blockquote>
    <blockquote type="cite">
      <pre wrap="">It is a comma-delimited file with 16 fields (15
commas). I need to
check and make sure that each line is only 129 characters and I assume
1 LF. What would be the best way to accomplish this?
      </pre>
    </blockquote>
    <pre wrap="">Are you reading an ASCII file from one Windows machine to
another
Windows machine?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Unix ascii file
  </pre>
</blockquote>
Jeff, if you use line sequential files, you should not have to care
about the LF. The records will be 129 chars long.<br>
Then, use unstring :<br>
1 my-record.<br>
&nbsp;&nbsp;&nbsp; 2 my-field pic(129) occurs 16.<br>
.....<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; my-field(13),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; my-field(14),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; my-field(15),<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; my-field(16)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
end-unstring<br>
<br>
<br>
Regards.<br>
<br>
Alain<br>
<br>
</body>
</html>

--------------070908040207020206000407--
 




 32 Posts in Topic:
Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 06:37:11 
Re: Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 07:02:32 
Re: Validating input file
"Rick Smith" &l  2008-05-13 10:10:46 
Re: Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 07:19:17 
Re: Validating input file
"Rick Smith" &l  2008-05-13 11:22:00 
Re: Validating input file
Howard Brazee <howard@  2008-05-13 08:27:03 
Re: Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 07:29:57 
Re: Validating input file
Howard Brazee <howard@  2008-05-13 09:05:10 
Re: Validating input file
Alain Reymond <arwebma  2008-05-13 17:15:12 
Re: Validating input file
"HeyBub" <he  2008-05-13 12:55:55 
Re: Validating input file
Howard Brazee <howard@  2008-05-13 09:44:30 
Re: Validating input file
"HeyBub" <he  2008-05-13 10:07:26 
Re: Validating input file
Howard Brazee <howard@  2008-05-13 09:20:32 
Re: Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 08:12:00 
Re: Validating input file
"HeyBub" <he  2008-05-13 12:51:13 
Re: Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 08:51:02 
Re: Validating input file
Howard Brazee <howard@  2008-05-13 10:17:53 
Re: Validating input file
"Rick Smith" &l  2008-05-13 12:46:06 
Re: Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 09:21:54 
Re: Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 10:03:50 
Re: Validating input file
"Rick Smith" &l  2008-05-13 13:38:03 
Re: Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 10:07:31 
Re: Validating input file
jeff <jmoore207@[EMAIL  2008-05-13 10:42:37 
Re: Validating input file
"Rick Smith" &l  2008-05-13 14:24:42 
Re: Validating input file
"William M. Klein&qu  2008-05-13 23:14:07 
Re: Validating input file
Graham Hobbs <ghobbs@[  2008-05-13 21:37:46 
Re: Validating input file
Robert <no@[EMAIL PROT  2008-05-13 21:13:33 
Re: Validating input file
"William M. Klein&qu  2008-05-14 02:21:22 
Re: Validating input file
"Rick Smith" &l  2008-05-13 23:03:21 
Re: Validating input file
Robert <no@[EMAIL PROT  2008-05-13 21:35:08 
Re: Validating input file
Robert <no@[EMAIL PROT  2008-05-14 00:11:29 
Re: Validating input file
"Michael Mattias&quo  2008-05-14 08:38:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 2:33:31 CDT 2008.