Reading the part of the AS/400 string

145 pts.
Tags:
AS/400
Physical File
Hi, I have a Source line in QRpglesrc, There are N number of source line in my source physical file (Qrpglesrc). In that For Example I have a field, with Item = 'find the number of string' to be read. I want a logic to pick only the string within the quotes. it mean i need to pick the string within the quotes. I don't any other string in that same source code line.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Have you looked at the BIF’s ? you can probably use %scan. If the field you want to find has the quotes included you may have to build a work filed with them included. You can do this by concatenating the data like this, define the quotes as a constant.then it’s easy.

 eval workfld = quote + string + quote 
then %scan for your work field.

Discuss This Question: 7  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Splat
    Are you trying to write a program to locate that string or are you trying to locate that string using a source editor?
    7,425 pointsBadges:
    report
  • srivijay1
    i am tring to write a program

    145 pointsBadges:
    report
  • WoodEngineer
    Your program could scan for a quote.  If found, scan for the second quote starting a the position of the first quote + 1.  Once you  know the positions of the two quotes, use the substring feature to retrieve the string.
    6,715 pointsBadges:
    report
  • Splat
    Is the string you're looking for constant, or are you just looking for quoted strings, no matter what is within the quotes?
    7,425 pointsBadges:
    report
  • abhisheka1
    create data structure within program
    385 pointsBadges:
    report
  • WoodEngineer
    A data structure will work but requires more code than using %scan and %substr.  What version of the operating system are you using?
    6,715 pointsBadges:
    report
  • srivijay1
    Hi thanks to everyone for the replay. In Rpgle i tried to scan quotes(') but i failed. Then i try using the hexa decimal value as given below
      DApostrophe       C                   Const(X'7D')   

    then i did scaning by 

     %Scan(apostrophe:Srcdta)>0;                         
                                                         
     Pos = %Scan(apostrophe : SrcDta);                   
     Pos1 = %Scan(apostrophe : SrcDta :Pos + 1);         
     SrcDta1 = %Subst(SrcDta : pos+1 : pos1 -pos-1);     

    Its Works.. Is there any other method to scan the Apostrophe(')..Kindly share
    145 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following