IF_STATUS question

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
John
Posts: 24
Joined: Thu Aug 10, 2017 3:21 pm

IF_STATUS question

Post by John »

Srvroutine Name(GetServiceAdvisorDtl)
Field_Map For(*Input) Field(#CONO1A) Parameter_Name(Company)
Field_Map For(*Input) Field(#TPAC1A) Parameter_Name(Dealer)
Field_Map For(*Input) Field(#DSEQ1A) Parameter_Name(DealerSeq)
Field_Map For(*INPUT) Field(#CTNU1A) Parameter_Name(ContactNo)
Group_Map For(*OUTPUT) Group(#ServiceAdvisorDtl) Parameter_Name(Serviceadvisorlist)
Field_Map For(*OUTPUT) Field(#IO$STS) Parameter_Name(Status)

Fetch Fields(#ServiceAdvisorDtl) From_File(T1P1ALU2) With_Key('SZ' 'SL' #CONO1A #TPAC1A #DSEQ1A 'SADV' #CTNU1A)

If_Status Is(*OKAY)

Fetch Fields(#STST1E) From_File(T1P1AELU1) With_Key(#CONO1A #TPAC1A #DSEQ1A #CTCT1A) Io_Status(#IO$STS)
If_Status Is_Not(*OKAY)
#STST1E := '????????'
Endif

Endif
Endroutine

The second Fetch does not get a record as I know I haven't included an extra key for it to work.

In debug, IO$STS = 'OK'. The help says "It allows the status of the last I/O command to be tested ".

So why hasn't an IO$STS been set from the second fetch to another status like 'ER' 'NR' 'EF' or 'NE' ?
atostaine
Posts: 696
Joined: Wed Jan 20, 2016 7:38 am

Re: IF_STATUS question

Post by atostaine »

If you didn't add the extra key then it will get the first record equal to the key fields provided.
Art Tostaine
John
Posts: 24
Joined: Thu Aug 10, 2017 3:21 pm

Re: IF_STATUS question

Post by John »

Thank you, that makes sense :-)
Post Reply