Skip to Main Content
IBM Power Ideas Portal


This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Not under consideration
Workspace IBM i
Categories Languages - Other
Created by Guest
Created on Jul 26, 2016

C++ fstream should return relative record for DB2 PF-SRC when using tellg() method.

The C++ class ifstream supports both IFS files as well as IBM i Db2 database files, and specifically Db2 Source Physical File Members as "text files".
ifstream f("/home/cozzi/file.txt");
is treated via the interface the same as:
ifstream f("/qsys.lib/mylib.lib/qtxtsrc.file/log.mbr");

Both files may be read using >> or the getline() method.
When using the ifstream::seekg() method, both position the file to the proper location; character position for IFS stream files, and relative record number for Db2 Database Source File Members.

However, the tellg() method (the routine used to retrieve the current position in the file) is disabled while processing Db2 Database Source File members while enabled for IFS text stream files.
This method should return the current relative record number when the ifstream object is referencing Db2 Database Source File Members. Currently it returns only -1.


Use Case:

This allows programmers to position the Db2 for i Database Source File member to another location in the file/member while it is being processed. This is a fundamental capability. The seekg() method does provide this capability, however the ability to "know" what record you want to position to is normally obtained at runtime, thus needs to be returned via tellg() or similar. Today this is not possible.


Idea priority High
  • Guest
    May 14, 2020

    It is not the tellg() function that is initially failing, it is the seekg(). Regardless of that detail, the real source of the problem and the main difference between QSYS.LIB and other file systems is summed up in the following statement from the lseek() API reference:
    In the QSYS.LIB file and independent ASP QSYS.LIB file systems, while in text mode, you can only seek to the beginning of a member; otherwise, error [EINVAL] will be returned.
    As described by the statement from the lseek() API reference, it is the source of the problem. And there are no plans to remove that restriction.

  • Guest
    Apr 27, 2020

    Due to processing by IBM, this request was reassigned to have the following updated attributes:
    Brand - Servers and Systems Software
    Product family - Power Systems
    Product - IBM i
    Component - Languages - Other
    Operating system - IBM i
    Source - ISV (Independent Software Vendor)

    For recording keeping, the previous attributes were:
    Brand - Servers and Systems Software
    Product family - Programming Languages
    Product - C/C++ Compilers
    Component - Miscellaneous
    Operating system - IBM i
    Source - ISV (Independent Software Vendor)

  • Guest
    Jun 19, 2019

    The email for the developer who requested clarity is bouncing so I'm guessing he's not in that role any longer. So I'm posting my response to him here, so there his replacement can review it.

    Hello,

    I am using the seekg() and tellg() methods of the ifstream class in the C++ language on IBM i.

    When the file being processed is an IFS text file, these functions work properly.
    When the file being processed is a native Db2 table, the tellg() method returns nothing.
    It should return the row's relative record number to be consistent. I believe this to either be an oversight or a bug.

    Thank you!

    -Bob Cozzi

  • Guest
    Nov 1, 2016

    Waiting on client info.

  • Guest
    Oct 31, 2016

    Hi, Mr Bob_Cozzi. Which C runtime API do you use? Could you please send your test code to my email? My email address is my nickname. Thanks.

  • Guest
    Oct 26, 2016

    This is not true. I modified the routine to use the C runtime library and the results were as desired.

  • Guest
    Oct 26, 2016

    This is not true, I switch the routine to use the normal seats and it works as desired

  • Guest
    Oct 25, 2016

    Inside C++ runtime function tellg(), file system API lseek() is invoked. Following is the statement about from the lseek() API reference (http://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/apis/lseek.htm)

    "In the QSYS.LIB file and independent ASP QSYS.LIB file systems, while in text mode, you can only seek to the beginning of a member; otherwise, error [EINVAL] will be returned."

    This is the root cause of the problem. Given nature of the QSYS.LIB file system, we would like to consider this as a system restriction and do not plan to implement the required function.

    Thanks

  • Guest
    Aug 25, 2016

    This tellg() function calls a file system API, we are still doing investigation together with Integrated File System team.

  • Guest
    Aug 24, 2016

    This RFE is still being investigated.