From: elsolo21 on 12 Aug 2010 09:21 I've searched for this answer but I'm not sure if I'm looking for the right thing. I'm reading data from a table with both a fixed segment and variable segment. I can read from the fixed segment just fine but I have no idea how to continue on and pull data from the variable segment. I'm using SAS 9.3.1 on a Z/os mainframe. Please let me know what additional information is needed to help me with this. thanks.
From: data _null_; on 12 Aug 2010 09:40 On Aug 12, 8:21 am, elsolo21 <eric_solo...(a)hotmail.com> wrote: > I've searched for this answer but I'm not sure if I'm looking for the > right thing. I'm reading data from a table with both a fixed segment > and variable segment. I can read from the fixed segment just fine but > I have no idea how to continue on and pull data from the variable > segment. I'm using SAS 9.3.1 on a Z/os mainframe. Please let me know > what additional information is needed to help me with this. > > thanks. The details are in the details. What are the details relating to the variable length segment? I can think of two scenarios that have very different solutions, and that's just two possibilities.
From: elsolo21 on 12 Aug 2010 09:51 On Aug 12, 9:40 am, "data _null_;" <datan...(a)gmail.com> wrote: > On Aug 12, 8:21 am, elsolo21 <eric_solo...(a)hotmail.com> wrote: > > > I've searched for this answer but I'm not sure if I'm looking for the > > right thing. I'm reading data from a table with both a fixed segment > > and variable segment. I can read from the fixed segment just fine but > > I have no idea how to continue on and pull data from the variable > > segment. I'm using SAS 9.3.1 on a Z/os mainframe. Please let me know > > what additional information is needed to help me with this. > > > thanks. > > The details are in the details. What are the details relating to the > variable length segment? I can think of two scenarios that have very > different solutions, and that's just two possibilities. I'm not sure what details you need but I'll try to put out there whatever info I have: This is a COBOL-created table. I'm getting the information from the copybook. The last line on the fixed segment is called: VAR-BYTE-COUNT PIC 9999 COMP The variable segment looks similar to the fixed segment in that layout with fields defined the same way. I'm sorry this isn't much to go on. If you have anything specific that you need let me know and I'll see if I can find that out. thanks.
From: data _null_; on 12 Aug 2010 10:13 On Aug 12, 8:51 am, elsolo21 <eric_solo...(a)hotmail.com> wrote: > On Aug 12, 9:40 am, "data _null_;" <datan...(a)gmail.com> wrote: > > > On Aug 12, 8:21 am, elsolo21 <eric_solo...(a)hotmail.com> wrote: > > > > I've searched for this answer but I'm not sure if I'm looking for the > > > right thing. I'm reading data from a table with both a fixed segment > > > and variable segment. I can read from the fixed segment just fine but > > > I have no idea how to continue on and pull data from the variable > > > segment. I'm using SAS 9.3.1 on a Z/os mainframe. Please let me know > > > what additional information is needed to help me with this. > > > > thanks. > > > The details are in the details. What are the details relating to the > > variable length segment? I can think of two scenarios that have very > > different solutions, and that's just two possibilities. > > I'm not sure what details you need but I'll try to put out there > whatever info I have: > > This is a COBOL-created table. I'm getting the information from the > copybook. > The last line on the fixed segment is called: VAR-BYTE-COUNT PIC > 9999 COMP > The variable segment looks similar to the fixed segment in that layout > with fields defined the same way. > > I'm sorry this isn't much to go on. If you have anything specific > that you need let me know and I'll see if I can find that out. > > thanks. Sounds like VAR-BYTE-COUNT give the number of bytes in the variable segment. If so then the $VARYING format should work. input {your fixed segment inputs with VAR_BYTE_COUNT as last field read} variable_segment $varying2048. var_byte_count; You may need a number different from 2048. This will declare the width for the variable VARIABLE_SEGMENT ifs it is not already defined.
From: elsolo21 on 12 Aug 2010 10:43
On Aug 12, 10:13 am, "data _null_;" <datan...(a)gmail.com> wrote: > On Aug 12, 8:51 am, elsolo21 <eric_solo...(a)hotmail.com> wrote: > > > > > > > On Aug 12, 9:40 am, "data _null_;" <datan...(a)gmail.com> wrote: > > > > On Aug 12, 8:21 am, elsolo21 <eric_solo...(a)hotmail.com> wrote: > > > > > I've searched for this answer but I'm not sure if I'm looking for the > > > > right thing. I'm reading data from a table with both a fixed segment > > > > and variable segment. I can read from the fixed segment just fine but > > > > I have no idea how to continue on and pull data from the variable > > > > segment. I'm using SAS 9.3.1 on a Z/os mainframe. Please let me know > > > > what additional information is needed to help me with this. > > > > > thanks. > > > > The details are in the details. What are the details relating to the > > > variable length segment? I can think of two scenarios that have very > > > different solutions, and that's just two possibilities. > > > I'm not sure what details you need but I'll try to put out there > > whatever info I have: > > > This is a COBOL-created table. I'm getting the information from the > > copybook. > > The last line on the fixed segment is called: VAR-BYTE-COUNT PIC > > 9999 COMP > > The variable segment looks similar to the fixed segment in that layout > > with fields defined the same way. > > > I'm sorry this isn't much to go on. If you have anything specific > > that you need let me know and I'll see if I can find that out. > > > thanks. > > Sounds like VAR-BYTE-COUNT give the number of bytes in the variable > segment. If so then the $VARYING format should work. > > input {your fixed segment inputs with VAR_BYTE_COUNT as last field > read} > variable_segment $varying2048. var_byte_count; > > You may need a number different from 2048. This will declare the > width for the variable VARIABLE_SEGMENT ifs it is not already defined.- Hide quoted text - > > - Show quoted text - I thought $varying only works when one variable is a variable length. I have a few dozen in this variable segment. How do I pull out specific ones? I did try you method and the error I got was: WARNING: VARIABLE VARIABLE_SEGMENT HAS ALREADY BEEN DEFINED AS NUMERIC. I used your example above. I think that error is because I left something out or made wrong assumptions from your example. Thanks for the help so far! |