+ Reply to Thread
Results 1 to 7 of 7

Thread: How can I get the value of this field?

  1. #1

    Default How can I get the value of this field?

    Since no one else has replied, I'll tell you a couple of things I'd try... 1. I think you might be able do it with pointers. Somehow... 2. You could use SQL to extract the value.

  2. #2

    Default How can I get the value of this field?

    As you read the QDDSSRC file keep track of the location of the fields and their data type in the record (along with the names); or alternatively use the QUSLFLD (List Fields) API to determine file field names, types, and locations. Read the customer record into a data structure or single large field and then use the substring capability of RPG to substring out the CustNo value (based on its location within the record) from the data structure/field. If CustNo is character based (or zoned decimal) then you've got what you want. If CustNo happens to be packed decimal, binary, etc. then you need to convert the value you substringed out to a zoned decimal or character definition. This can be done using various sized and typed fields within your program as the target of your substring (redefined as character) and then setting a zoned decimal field to the value (this could be a real pain if you have great variety in the number of decimal positions to the right of the decimal point -- assuming you are after a general solution and not just CustNo)); or more directly by using the Copy Numeric Value MI instruction within your program (assuming you are using ILE based RPG).

  3. #3

    Default How can I get the value of this field?

    bvining: One way to solve the packed problem in your method would be to use an array for the characters and overlay only the number of bytes needed onto a large packed field, padded on the left with 0s.

  4. #4
    buck.calabro@commsoft.net Guest

    Default How can I get the value of this field?

    > I am trying to put the value of a field in a text string. There is an explanation of how to do this with SQL in the FAQ at http://faq.midrange.com The search link is at the lower left. I think it's under 'indirect'. --buck

  5. #5

    Default How can I get the value of this field?

    That is what I had in mind but I'm thinking that getting the decimal point right means a few redefinitions (though I must admit I haven't given this a great deal of thought).

  6. #6

    Default How can I get the value of this field?

    I don't see a quick solution for the decimal point, either. Buck's suggestion is actually a robust method for this, but since joestone already knows the field name, I'm thinking a simple dynamic SQL would be the way to go, unless it's being done thousands of times. (Note, the method Buck pointed out uses dynamic SQL, and it also includes code to make sure the field is valid, that it indeed contains data, etc.)

  7. #7
    Guest.Visitor Guest

    Default How can I get the value of this field?

    I am trying to put the value of a field in a text string. Simple enough, but I want the field name to come from an array. I do not have the value of the field in the array, only the name. I fill an array from reading the QDDSSRC into my RPG program. The array is called FieldNames: CustNo, Addr, City, State, Zip I read the physical file and want to put the values for CustNo into a text string. When I run the program I don't know the name of the fields. They are in the array. Does anybody have a clue? Is this even possible?

+ Reply to Thread

Similar Threads

  1. Problem with Date Type field and field Reference File
    By David Abramowitz in forum General
    Replies: 2
    Last Post: 07-27-2006, 10:32 AM
  2. Moving a date defined field to a numeric field using free format
    By buck.calabro@commsoft.net in forum General
    Replies: 2
    Last Post: 05-25-2004, 02:00 AM
  3. API for Changing the Field Description or Text of a field inPF
    By David Abramowitz in forum Programming
    Replies: 4
    Last Post: 05-25-2001, 06:23 AM
  4. Number in a text field into a numeric field
    By Guest.Visitor in forum Programming
    Replies: 6
    Last Post: 03-15-2001, 01:10 AM
  5. Moving numeric field to date data type field.
    By Guest.Visitor in forum Application Software
    Replies: 19
    Last Post: 08-20-2000, 04:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts