Page 1 of 1

IF_STATUS question

Posted: Thu Jan 18, 2018 12:49 pm
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' ?

Re: IF_STATUS question

Posted: Thu Jan 18, 2018 12:51 pm
by atostaine
If you didn't add the extra key then it will get the first record equal to the key fields provided.

Re: IF_STATUS question

Posted: Thu Jan 18, 2018 1:08 pm
by John
Thank you, that makes sense :-)