473,473 Members | 1,563 Online
Bytes | Software Development & Data Engineering Community
Create 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 6383
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(FILE_OPEN_,READX)> */
#include <cextdecs (\
READUPDATELOCKX,\
READX,\
FILE_GETINFO_,\
FILE_OPEN_,\
FILENAME_DECOMPOSE_,\
FILENAME_RESOLVE_,\
WRITEUPDATEUNLOCKX\
)>

#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("Filename = %s\n" , fname );
retcode = FILE_OPEN_(fname, /* name of Guardian file*/
(short)strlen(fname), /* 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(CC))
{
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.TES1DATA.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
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
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...
10
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...
1
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...
4
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...
8
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
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...
5
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...
6
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
muto222
php
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.