Max file size PB can open

Max file size PB can open

I need to develop a program interfaced with a Sybase database. First I have to open a huge ASCII file (size ranges from 20 to 100 MB) to read and convert it to a preformatted ASCII file for the database.

Can PB open such a large ASCII file if my PC has 32 MB of memory? If so, how?

The size of the file makes no difference to PowerBuilder, because it reads only 32K chunks at a time. Obviously if you read the whole file in 32Kchunks and tried to store them in memory as one continuous block, you’dhave problems.

Assuming your data has some kind of structure to it, you can read thedata in 32K chunks and process as much of the first chunk as possible,then append the next chunk to the end of what’s left of the chunk, andcontinue until you process the whole file.

The following code will read a large file into a blob variable. I suggest that instead of concatenating the chunks into the blob, youperform only the processing you need to do.

integer fnum, loops, ilong flen, bytes_read, new_posblob b, tot_b// Set a wait cursorSetPointer(HourGlass!)// Get the file length, and open the fileflen = FileLength(sle_filename.Text)fnum = FileOpen(sle_filename.Text,  &	StreamMode!, Read!, LockRead!)// Determine how many times to call FileRead IF flen > 32765 THEN   IF Mod(flen, 32765) = 0 THEN      loops = flen/32765   ELSE      loops = (flen/32765) + 1   END IFELSE   loops = 1END IF// Read the filenew_pos = 1FOR i = 1 to loops   bytes_read = FileRead(fnum, b)   // Here you perform your processing on the current chunk   tot_b = tot_b + bNEXTFileClose(fnum)

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as