Thursday, 15 January 2015

cobol - Is there a way to automatically fill in array after getting user input? -


I have an array of 5 elements and each element has one letter I want to accept user input in one line For example: ABCDE and I have an element of array 1, in which the element of A and Mant 2 is to be B. and so on. Can anyone help with this? I've attached the relevant section of the code below:

  Environmental partition input output section file-control. Select Assign standard output to display the keyboard select standard input. Data Division File Section FD Standard Input 01 stdin-record pic x (80). FD standard output 01 stdout-record pic x (80). Work storage section 01 Input field 02 The picture of the input field is x five times (1). 01 Print-Line 02 The picture of the input field is x five times (1). Process partition open input standard input, output standard output end-standard standard input, read standard-input in the input field on standard output read-write 5 line end-write stop run after the progress of the print-line from the print-out-record Write.  

  move the input field to the print-line  

For your code, you can also do this:

  After writing 5 line-written  
from the input field Type stdout-record

If you do not need two copies of a table (COBOL does not actually contain "arrays", then probably used for you), then there are no two copies.

If you have two tables, I suggest that the name of the item should be different if you do not do so, then by using "qualification" to make references specific, Are making difficult. Input area field input input (1) to the input line (1) On the print-line

instead of

  input sector (1) for output ( 1)  

If you do not consider yourself as a person's worth, you feel that coworkers or keepers of the future hate it.

I am not sure what you want to do with it:

  read standard input-input in input-field in standard-standard input, standard output end-read  

You only have one read , you will only get end when no data will be done (whatever it means keyboard ). In that case, you do not have data to do anything.

You should see how to use FILE STATUS for each file. Check the file-status field after each IO, and I recommend using the file-status field, which is to check the file instead of being at the end of AT.

However, as I said, I do not know what it means with the keyboard ... so it probably will not work: -)


No comments:

Post a Comment