Performing File Operations
+19
sp.alfiler
rapal
madera16
Ferre
Asdfghjkl
Vann Lewis
Bermon O. Ferreras Jr
Emie Ligutan
ellariana
Rfrancis03
mikolunzxc
:BOAR'SWrath:
iramae
Jericho
Lawrence
airojames
Luwiezzz
James Navarro
Admin Rash
23 posters
Performing File Operations
Fri Aug 10, 2018 8:04 am
Our business is about technology, yes. But it's also about operations and customer relationships. ㅡ Michael Dell
To use data files in your programs, you need to understand several file operations:
- Declaring a file identifier
- Opening a file
- Reading from a file and processing the data
- Writing to a file
- Closing a file
--
Declaring a File Identifier
Most languages support several types of files, but one way of categorizing files is by whether
they can be used for input or for output. Just as variables and constants have data types such as
num and string, each file has a data type that is defined in the language you are using.
InputFile employeeData
OutputFile updatedData
--
Opening a File
Opening a file locates it on a storage device and associates a variable name within your program with the file.
--
Reading Data from a File and Processing it
Before you can use stored data within a program, you must load the data into computer memory. You never use the data values that are stored on a storage device directly. Instead, you use a copy that is transferred into memory. When you copy data from a file on a storage device into RAM, you read from the file.
input name from employeeData
input address from employeeData
input payRate from employeeData
Most languages also allow you to write a single statement in
the following format:
input name, address, payRate from employeeData
A computer program can read records from a file sequentially or randomly.
Sequential files, reads all the records in the file from beginning to end, processing
them one at a time.
Sorting is the process of placing records in
order by the value in a specific field or fields.
Examples of sorted, sequential files include the following:
- A file of employees whose data is stored in order by ID number
- A file of parts for a manufacturing company whose data is stored in order by part number
- A file of customers for a business whose data is stored in alphabetical order by name
--
Writing Data to a File
When you store data in a computer file on a persistent storage device, you write to the file . This means you copy data from RAM to the file. When you write data to a file, you write the contents of the fields using a statement such as the following:
output name, address, payRate to employeeData
--
Closing a File
When you finish using a file, the program should close the file —a closed file is no longer
available to your application. Failing to close an input file (a file from which you are reading
data) usually does not present serious consequences; the data still exists in the file.
--
A Program that Performs File Operations
The flowchart contains a program that opens two files—an input file and an output file. The program reads each employee record from the input file, alters the employee’s pay rate, and writes the updated record to an output file. After all the records have been processed, the program closes the files.
A backup file is a copy that is kept in case values need to be restored to their original state. The backup copy is called a parent file and the newly revised copy is a child file .
- James NavarroMay Guardian Angel
- Posts : 18
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 10:28 am
Thank you po maam for this post, very well explained po
Sent from Topic'it App
Sent from Topic'it App
- LuwiezzzGuru
- Posts : 10
Join date : 2018-08-09
Re: Performing File Operations
Sat Aug 11, 2018 12:22 pm
Thank you Ms. Rashlyn for this, it really helped me a lot understanding file operations
- LuwiezzzGuru
- Posts : 10
Join date : 2018-08-09
Re: Performing File Operations
Sat Aug 11, 2018 12:36 pm
Is Sorting a necessity? Or it depends on the user?
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:06 pm
Ano po midterm exam namin? Written or actual? Haha
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:08 pm
Mam dba gumawa ng yung database ng new file so d pa rin mawawala yung unang file eh paano po kung inulit yun 100times nandoon pa rin po ba yung unang file?
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:08 pm
*na
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:09 pm
Grabe this forum help me a lot
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:12 pm
Mam if binura ko po yung parent file mawawala na po ba yung child file?
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:13 pm
May link connection po ba yung parent file and child file?
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:14 pm
Database din po ba yung pagsstack ng input sa range? Example po yung price[6]=0,0,0,0,0,0
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:15 pm
Backup copy pala yung parent file edi pagnawala po sya hindi po mawawala yung child file? Or mawawala din po sya naguguluhan po kasi ako
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:17 pm
Yung sorting po ba dyan sa datbase is like arrangement in alphabetical order or any order that is needed
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:18 pm
Comma delimiter lang po talaga pwede gamitin? Bawal na po yung ibang character?
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:19 pm
Kapag pala ginamit mo yung data sa database d sya yung mismo maaaccess mo yung copy pang po nya?
Sent from Topic'it App
Sent from Topic'it App
- airojamesGuru
- Posts : 12
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 6:19 pm
Andami ko pong natutunan dahil sa forum na to haha Thanks a lot po
Sent from Topic'it App
Sent from Topic'it App
- LawrenceGuru
- Posts : 10
Join date : 2018-08-11
Re: Performing File Operations
Sat Aug 11, 2018 8:13 pm
i think pre meron siyang connection. bale hindi magkakaroon ng child file kapag walang parent fileairojames wrote:May link connection po ba yung parent file and child file?
Sent from Topic'it App
Re: Performing File Operations
Thu Aug 16, 2018 7:34 am
you're right! It depends on the user whether he/she will sort the records or files.Jericho wrote:Luwiezzz wrote:Is Sorting a necessity? Or it depends on the user?
it depend to the user.
- JerichoGuru
- Posts : 10
Join date : 2018-08-16
Re: Performing File Operations
Thu Aug 16, 2018 7:44 am
airojames wrote:Comma delimiter lang po talaga pwede gamitin? Bawal na po yung ibang character?
Sent from Topic'it App
Depende sa program language. Pag sa flowchart i think da best na yung pag gamit ng comma.
- JerichoGuru
- Posts : 10
Join date : 2018-08-16
Re: Performing File Operations
Thu Aug 16, 2018 7:46 am
airojames wrote:Yung sorting po ba dyan sa datbase is like arrangement in alphabetical order or any order that is needed
Sent from Topic'it App
it depends. pwedeng alphabetical, size or date created.
- iramaeGuru
- Posts : 10
Join date : 2018-08-07
Re: Performing File Operations
Thu Aug 16, 2018 7:46 am
airojames wrote:Yung sorting po ba dyan sa datbase is like arrangement in alphabetical order or any order that is needed
Sent from Topic'it App
Yes, in database, same lang din yung pag sort niya sa reality.
- iramaeGuru
- Posts : 10
Join date : 2018-08-07
Re: Performing File Operations
Thu Aug 16, 2018 7:47 am
Lawrence wrote:i think pre meron siyang connection. bale hindi magkakaroon ng child file kapag walang parent fileairojames wrote:May link connection po ba yung parent file and child file?
Sent from Topic'it App
Yeah tama naman.
Re: Performing File Operations
Thu Aug 16, 2018 7:48 am
Yes we all know that the revised version of Parent file is Child file. So probably, may connection sila.iramae wrote:Lawrence wrote:i think pre meron siyang connection. bale hindi magkakaroon ng child file kapag walang parent fileairojames wrote:May link connection po ba yung parent file and child file?
Sent from Topic'it App
Yeah tama naman.
- JerichoGuru
- Posts : 10
Join date : 2018-08-16
Re: Performing File Operations
Thu Aug 16, 2018 7:48 am
if separated na silang file, then hindi mawawala ang isa pag na delete ang isang file.airojames wrote:Backup copy pala yung parent file edi pagnawala po sya hindi po mawawala yung child file? Or mawawala din po sya naguguluhan po kasi ako
Sent from Topic'it App
Re: Performing File Operations
Thu Aug 16, 2018 7:52 am
They're already independent. Related lang sila since they almost both contain same records.Jericho wrote:if separated na silang file, then hindi mawawala ang isa pag na delete ang isang file.airojames wrote:Backup copy pala yung parent file edi pagnawala po sya hindi po mawawala yung child file? Or mawawala din po sya naguguluhan po kasi ako
Sent from Topic'it App
Permissions in this forum:
You cannot reply to topics in this forum