Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7935541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:57:12+00:00 2026-06-03T21:57:12+00:00

I am pulling data from a database that uses the ASCII character 254 as

  • 0

I am pulling data from a database that uses the ASCII character 254 as the delimiter. I’m stumped as to how to search the string returned for the 254 and then create dictionary based on that?

My python class

import sys
sys.path.append('C:\\IBM\\UniDK\\uojsdk\\lib\\asjava.jar')
import os.path

from asjava.uniclientlibs import UniDynArray, UniDataSet
from asjava.uniobjects import UniSession, UniFile
from asjava.uniobjects import UniSubroutineException
from asjava.uniobjects.UniObjectsTokens import AT_FM

class u2py :

        def __init__ (self):
            self.conn = UniSession()

        def get_db(self):
            """ establish a connection to Unidata """
            username = 'dbuser'
            password = 'SuperSecretPassword'
            return  self.conn.connect("host", username, password, "ACCOUNT")

        def close_db(self):
            """ drop connection to Unidata """
            if self.conn.isActive():
                self.conn.disconnect()

        def open_file(self,file_name,rec):
            """ open a U2 file read a record and return it """
            uvfile = self.conn.open(file_name)
            uvrec = uvfile.read(rec)
            dataset = uvrec
            uvfile.close()
            return dataset

        def open_field(self,file_name,rec,field):
                    """ open a U2 file read a record and return it """
                    uvfile = self.conn.open(file_name)
                    uvrec = uvfile.readField(rec,field)
                    dataset = uvrec
                    uvfile.close()
                    return dataset

Here is my code in the console:

from u2py import *

u2 = u2py()
c = u2.get_db() #creates the connection to the DB
c #actually makes the connection
rec = u2.open_file('SOFILE','SO133700')
print rec

Which then prints this to the screen:

ZZZAA■XN3■CEL■931819501■20020215■BWI/PP■■

“■” is actually a field mark chr(254)

EDIT:

When I use this:

    >>>rec = u2.open_file('SOFILE','SO133699').split(chr(254))

I get this error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'asjava.uniclientlibs.UniString' object has no attribute 'split'

EDIT and FINAL answer:

Using UniObjects Java

rec.toString().split(chr(254)) 

SUCCESS!!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:57:14+00:00Added an answer on June 3, 2026 at 9:57 pm

    your_string.split(chr(254)), e.g.

    >>> "foo\xFEbar\xFEbaz".split(chr(254))
    ['foo', 'bar', 'baz']
    

    This returns a list. How to build a dictionary from this I’ll leave to you, since I don’t know what you want for keys and values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am pulling data from a database that uses ascii character 254 as a
My jqGrid that does a great job of pulling data from my database, but
I have the following function that is pulling data from a database. The ajax
I'm pulling in data from an external place database that returns JSON of information
I'm pulling data from my database that is as such (raw): long's streetWe’d tree
I have the following linq expression pulling all data from my database: var items
I have an INSERT query that is pulling data from two tables and inserting
Background: I'm building a small application that will be run daily, pulling data from
I'm pulling serialized data from a database along with an object type (where one
I'm pulling data from a database and one of the tables contain two columns

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.