473,583 Members | 2,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How To read Tandem File Like PTLF, TLF

3 New Member
Hi all, I got problem to read database tandem nonstop (TLF, PTLF) use C programming. I have use syntax C under tandem for read data use CC = READX( fnum, (char*)burn, sizeof(burn_def ), &readcnt );


anyone can help me ??
Sep 5 '07 #1
3 6399
dmjpro
2,476 Top Contributor
Hi all, I got problem to read database tandem nonstop (TLF, PTLF) use C programming. I have use syntax C under tandem for read data use CC = READX( fnum, (char*)burn, sizeof(burn_def ), &readcnt );


anyone can help me ??

For this you have to know the File Format.
You know that?

Kind regards,
Dmjpro.
Sep 5 '07 #2
weaknessforcats
9,208 Recognized Expert Moderator Expert
You are using sizeof burn_def. Is that what you want??
Sep 5 '07 #3
klikjaco
3 New Member
Thanks for your response to me. BTW I will show my source

/* Program 12.1 Writing a file a character at a time */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <tal.h> /* Note 1 */
/*#include <cextdecs.h(FIL E_OPEN_,READX)> */
#include <cextdecs (\
READUPDATELOCKX ,\
READX,\
FILE_GETINFO_,\
FILE_OPEN_,\
FILENAME_DECOMP OSE_,\
FILENAME_RESOLV E_,\
WRITEUPDATEUNLO CKX\
)>

#include "burn.h"

#define FEOK 0
#define FEEOF 1

_cc_status CC; /* Note 2 */
short retcode;
short gfnum;
char *fname;
char buffer[1024];
burn_def* burn;

/* =============== =============== =============== ========= */
int Burn_Open( short* fnumx )
{
printf("Filenam e = %s\n" , fname );
retcode = FILE_OPEN_(fnam e, /* name of Guardian file*/
(short)strlen(f name), /* filename length */
fnumx, /* file number returned */
1, /* open for read */
, /* exclusion */
, /* nowait depth */
, /* sync or receive depth */
);

if (retcode != 0) {
fprintf(stderr, "retcode = %d\n", retcode);
fprintf(stderr, "Can’t open %s\n", fname);
exit(1);
}
}

/* =============== =============== =============== ========= */
int Burn_read( burn_def* burn , short fnum)
{
short err;
short readcnt;

if (fnum < 0) {
printf("Fnum = %d\n", fnum );
Burn_Open( &fnum );
}

CC = READX( fnum, (char*)burn, sizeof(burn_def ), &readcnt );
printf("******* **** READX File = ************* \n" );
if(_status_ne(C C))
{
FILE_GETINFO_( fnum, &err );
if (err = FEEOF )
{
printf("Fnum 1 = %d\n", fnum );
printf("NILAI Error = %d\n", err );
printf("Bytes read 1 = %d\n", readcnt);
return err;
}
/* if condition code indicates an error */
fprintf(stderr, "Read error, bytes read = %d\n", readcnt);
exit(-1);
}
printf("Bytes read 2 = %d\n", readcnt);
return FEOK;
}

/* =============== =============== =============== ========= */
int main(int argc, char *argv[])
/*int main() */
{
int i;
short err;

/* Get Guardian filename and open the file. */
if (argc > 1)
fname = argv[1];
else
fname = "$DTUS4.TES1DAT A.BURN";

printf("MULAI READ FILE ************* \n" );
do
{
err = Burn_read ( burn , gfnum);
printf("LAST err = %d\n", err );
} while (err == FEEOF );

return( FEOK );
}




Maybe I want use my data in base24 like this (not tlf / ptlf ) but I need basic knowledge for access this file (update, delete, read )

FILE DDLBURNS

?dictn
?c burnh!

DEF BURN
02 PRIKEY.
04 BANK-ID PIC X(3).
02 BANK-NAME PIC X(15).
02 MAX-LIMIT PIC 9(8).
end.


file BURNH

#pragma section burn
#pragma fieldalign shared2 __burn
typedef struct __burn
{
struct
{
char bank_id[3];
} prikey;
char bank_name[15] ;
char max_limit[8];
} burn_def;
#define pext_def_Size 0
Sep 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
5314
by: Yang Li Ke | last post by:
Hi guys! I have some datas that I must check everytime a visitor comes to my site What is better to do: 1- Read data from a file or 2- Read data from a mysql db Thank you
0
1415
by: Amitpython | last post by:
Hello, I'm new to Python, and have not come accross any module or any interface developed for Tandem database. Is there one developed yet, or has someone wrote one which I can use? Any help will be greatly appreciated... Thanks, Amit.
10
2270
by: ZafT | last post by:
Thanks in advance for any tips that might get me going in the right direction. I am working on a simple exercise for school that is supposed to use read to read a file (about 10 MB). I am supposed to change the buffer size and see how this affects the read time. In other words, the buffer is supposed to limit how much of the file gets...
1
6732
by: cnu | last post by:
My program generates a log file for every event that happens in the program. So, I open the file and keep it open till the end. This is how I open the file for writing: <CODE> public CLogHandler() { this.m_fsLog = new FileStream(strTodaysLogFile, System.IO.FileMode.Append, System.IO.FileAccess.Write, System.IO.FileShare.Read);...
4
2726
by: ESPN Lover | last post by:
Below is two snippets of code from MSDN showing how to read a file. Is one way preferred over the other and why? Thanks. using System; using System.IO; class Test { public static void Main()
8
23895
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
2
12594
by: agphoto | last post by:
There is big or problem in open file in read and write mode.. $file = "data.txt"; $fp = fopen($file,"w+"); $line = fgets($fp,"120"); // i need only 1st line to read and upto 120 bytes echo $line; fclose($fp); coding is not problem, The problem is file modifier as mention in PHP
5
3293
by: lovecreatesbea... | last post by:
The condition at line 31 is added to check if the program finished to read the whole file. Is it needed and correct? Thank you. #include <fstream> #include <iostream> #include <string> using namespace std; int read(string filename, int last_pos) {
6
5793
by: =?Utf-8?B?VGhvbWFzWg==?= | last post by:
Hi, Is it possible to read a file in reverse and only get the last 100 bytes in the file without reading the whole file from the begining? I have to get info from files that are in the last 100 bytes of the file and some of these files are 600Mb -1 GB in size. I am getting "outofMemory.." exceptions on the largest files and the other files...
0
7811
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8159
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8314
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7922
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8185
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6571
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3836
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1416
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.