From: data _null_; on
On Aug 12, 3:27 pm, elsolo21 <eric_solo...(a)hotmail.com> wrote:
> On Aug 12, 11:54 am, "data _null_;" <datan...(a)gmail.com> wrote:
>
>
>
>
>
> > On Aug 12, 10:47 am, elsolo21 <eric_solo...(a)hotmail.com> wrote:
>
> > > On Aug 12, 11:18 am, "data _null_;" <datan...(a)gmail.com> wrote:
>
> > > > On Aug 12, 9:43 am, elsolo21 <eric_solo...(a)hotmail.com> wrote:
>
> > > > > 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!- Hide quoted text -
>
> > > > > - Show quoted text -
>
> > > > AND show some of your code not just error messages.- Hide quoted text -
>
> > > > - Show quoted text -
>
> > > Sorry for the lack of details.  I was able to get into the variable
> > > part.  I think I might be reading in the length wrong, however.  I'm
> > > formatting the PIC 9999 COMP as an IB2.0.  I'm pretty sure that's not
> > > right.   I'm only getting 20-30 characters of the variable segment.
> > > The fields in the fixed portion have comp-3 fields that I deal with
> > > all the time. I no longer get anymore errors, however!  Here is the
> > > code for reading in the length and the variable segment:
>
> > > @239  varlgth     IB2.0
> > > variable_segment $varying512. varlgth;
>
> > > I'm guessing at the 512 right now but I really only need the first 50
> > > so I'm ok if I cut stuff off.  I really appreciate the help!
>
> > > thanks!- Hide quoted text -
>
> > > - Show quoted text -
>
> > This may help converting picture to informat.
>
> >http://support.sas.com/kb/3/714.html-Hide quoted text -
>
> > - Show quoted text -
>
> Thanks, that helped a lot.  I still need to eventually figure out how
> to get the individual items from the large variable section but I got
> what I needed today.
>
> Thanks again for your help.- Hide quoted text -
>
> - Show quoted text -

Sounds like the large_variable_section may be composed of multiple
fields(s), probably fixed length?
If that is true then the byte count variable will allow you to know
may many fields to read.