Friday, December 08, 2006

ABAP学习

2. ABAP对象
2.1 面向对象基础
2.2 类和对象
2.3 方法
2.4 继承
2.5 接口
2.6 事件
2.1 面向对象基础
面向对象概念
ABAP Objects

2.2 类和对象
程序中的类定义 例8
定义系统全局类 例9
程序中的类实例
DATA objname TYPE REF TO classname
CREATE OBJECT objname
objname->comp
classname=>comp (CLASS-DATA静态)
Me=this

2.3 方法
参数的定义和传递
参数接口与功能模块极为相似
类创建器定义全局类时Method选项卡的Parame…
调用方法
CALL METHOD与功能模块的CALL FUNCTION类似
函数方法 例10
构造和析构方法
实例构造方法和对象构造方法

2.4 继承
继承的基本概念
单一继承,upcasting
多态性的继承实现
抽象类和最终类
2.5 接口
接口的定义与实现
接口引用 例11

2.6 事件
定义事件
声明事件(参数为值传递)、触发事件
事件处理方法 例12
声明事件处理方法、注册事件处理方法
3. 数据库操作
3.1 数据库基础
3.2 数据表维护
3.3 数据提取
3.4 数据更新
3.5 数据一致性
3.6 其他数据操作形式
3.1 数据库基础
在SAP系统中,数据库表的创建和维护一般通过数据字典进行,对表中数据的操作通常通过ABAP程序中的Open SQL语句完成。

SAP系统支持两种在程序中操作数据库的语句形式:ABAP的Open SQL语句以及特定数据库的自身SQL—Native SQL语句。

Open SQL使ABAP程序实现了数据库平台无关性,但Open SQL只能实现数据操纵(Data Manipulation查询更新),不能实现数据定义(Data Definition创建管理表、视图、索引)和数据控制(Data Control权限、安全性、一致性)

ABAP数据库操作的效率原则:减少数据库和应用服务器的负载

ABAP通过数据字典完成 Data Definition,通过 SAP LUW、SAP locking 、R/3权限实现 Data Control。


3.2 数据表维护
表字段
se11;数据库表与结构类型、表类型的区别:后二者是单纯的数据类型,前者还包含其他相关设定,如外码、索引等。
se11->database table->SPFLI 内容按钮 进入选择屏幕界面



3.2 数据表维护
技术设定 通过 Technical settings 按钮维护
操作数据库表时是否需要进行缓冲(对不需经常更新的数据库表提高后续查询效率)、是否要创建系统日志206
索引—仅包括部分字段的数据库表拷贝,通过 Indexes 按钮维护
主索引:只包含表关键字和指向整个数据条目的指针,系统自动生成
附属索引:根据其他字段生成索引,按指定方式排序,自行创建,协助主所以提高搜索效率。





3.3 数据提取
SELECT语句
选择单行数据 SELECT SINGLE
选择多行数据 循环选择/选择至内表 例13
指定查询条件 动态指定查询条件 例14 字符比较运算
select … where func like ‘EDIT#_%’ escape ‘#’.选定所有以”EDIT_”开始的功能名称
多表结合查询 select语句嵌套、for all entries选项、结合查询例15,16
组合查询结果 集函数、分组、升降序 例17, 18
其他格式说明 动态指定数据库表,指定数据区域,设置缓冲机制,
限定选择行数,se30性能分析
使用光标
3.4 更新数据
INSERT语句
插入单行:INSERT INTO dbtab VALUES wa.
插入多行:INSERT dbtab FROM TABLE itab.
UPDATE语句
更改单行:UPDATE dbtab set f1=g1…fn=gn where .
UPDATE dbtab FROM wa.
更改多行:UPDATE dbtab set f1=g1…fi=gi [where].
UPDATE dbtab FROM TABLE itab.
MODIFY语句 = INSERT + UPDATE,存在则更新,不存在则插入
DELETE语句 与INSERT类似

3.5 数据一致性
SAP LUW 与 DB LUW

在SAP系统中,两个数据一致状态中的时间间隔被称为LUW (Logical Unit of Work),每一个LUW都需要一个Commit或者Rollback作为结束标志。数据库LW与SAP系统无关,ABAP程序需要确定数据库LUW的触发时机。SAP系统中,数据库LUW是不能确保数据一致性的,每个对话步骤都会使一个数据库LUW结束,而很肯能用户通过多个行为才结束对所有数据库表的更新操作,一次SAP需要在数据库LUW的基础上发展自己的一致性维护机制,即SAP LUW,它可将多个数据库LUW进行捆绑,不进行真正的数据库修改。SAP LUW的两种数据库LUW捆绑机制,分别通过功能模块和子程序进行。
3.5 数据一致性
SAP数据锁定 se80->create->dictionary object->lock object

因为SAP的LUW概念独立于数据库LUW和对话步骤,所以SAP还需要自己定义数据库锁定机制。SAP LUW要求数据库对象的锁定在SAP LUW结束后释放,SAP提供一个逻辑数据锁定机制,基于系统特定的锁定服务应用服务器中的中心锁定表。

用户权限检查

SAP系统中,用户权限和其在程序中的评估是通过授权对象实现的。su21(多个对象被组合成一个类,分配给不同的应用)->BC_C->S_CARRID
授权对象不是一个个分配给系统用户,而是通过多个对象组合成的授权档案进行分配的。授权检查的类型:事务运行权限、程序运行权限、程序内部权限检查。

3.6 其他数据操作形式
文件接口
ABAP 程序读取数据库外部的数据源(即三层体系结构中的展示服务器(即程序员本机)和应用服务器),由于文件名和路径名在不同系统中有不同格式,文件操作也有平台相关性。可使用FILE事务创建逻辑文件名及路径名,ABAP程序中可使用功能模块FILE_GET_NAME得到当前平台可识别的文件名。

数据簇操作
簇(Cluster)是ABAP专有的数据存储形式,往往用于实现不同程序、事务之间方便的数据传递,没有必要单独创建数据库表,程序A中的数据可以暂存于某个位置的簇中,程序B运行时可以读取该簇,无需使用Open SQL。可存放数据簇的区域:ABAP内存、数据库表、跨事务缓存区。





一些例子:
11. 接口的实现
REPORT z_interface_demo.

interface status.
methods write.
endinterface. "status

class counter definition.
public section.
interfaces status.
methods increment.
private section.
data count type i.
endclass. "counter definition

class counter implementation.
method status~write.
write: / 'count in counter is', count.
endmethod. "status~write
method increment.
add 1 to count.
endmethod. "increment
endclass. "counter implementation

class bicycle definition.
public section.
interfaces status.
methods drive.
private section.
data speed type i.
endclass. "bicycle definition

class bicycle implementation.
method status~write.
write: / 'speed of bicycle is', speed.
endmethod. "status~write
method drive.
add 10 to speed.
endmethod. "drive
endclass. "bicycle implementation

data: count type ref to counter,
bike type ref to bicycle,
status type ref to status, "接口的引用作为工作区
status_tab type table of ref to status.

start-of-selection.

create object: count, bike.
do 5 times.
call method: count->increment,
bike->drive.
enddo.

append: count to status_tab,
bike to status_tab.

loop at status_tab into status.
call method status->write.
endloop.


12. 事件的触发及处理
REPORT z_class_counter_event.

CLASS vehicle DEFINITION INHERITING FROM object.
PUBLIC SECTION.
EVENTS: too_fast.
METHODS: accelerate,
show_speed.
PROTECTED SECTION.
DATA speed TYPE i.
ENDCLASS. "vehicle DEFINITION

CLASS vehicle IMPLEMENTATION.
METHOD accelerate.
speed = speed + 1.
IF speed > 5.
RAISE EVENT too_fast.
speed = 5.
ENDIF.
ENDMETHOD. "accelerate
METHOD show_speed.
WRITE: / 'Speed:', speed.
ENDMETHOD. "show_speed
ENDCLASS. "vehicle IMPLEMENTATION

CLASS handler DEFINITION.
PUBLIC SECTION.
METHODS handle_excess FOR EVENT too_fast OF vehicle.
ENDCLASS. "handler DEFINITION

CLASS handler IMPLEMENTATION.
METHOD handle_excess.
WRITE: / 'Speed can not be too fast.'.
* speed = 10.
ENDMETHOD. "handle_excess
ENDCLASS. "handler IMPLEMENTATION

DATA: o_vehicle TYPE REF TO vehicle,
o_handle TYPE REF TO handler.

START-OF-SELECTION.
CREATE OBJECT: o_vehicle, o_handle.
SET HANDLER o_handle->handle_excess FOR ALL INSTANCES.
DO 11 TIMES.
CALL METHOD o_vehicle->accelerate.
CALL METHOD o_vehicle->show_speed.
ENDDO.



13. 将数据选择至内表(多行)

DATA: BEGIN OF tab_type,
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
END OF tab_type.

DATA: spfli_tab1 TYPE TABLE OF spfli,
spfli_tab2 LIKE TABLE OF tab_type.

SELECT *
FROM spfli
INTO TABLE spfli_tab1
WHERE cityfrom = 'NEW YORK' AND cityto = 'LONDON'.

SELECT carrid connid
FROM spfli
INTO CORRESPONDING FIELDS OF TABLE spfli_tab2
WHERE cityfrom = 'NEW YORK' AND cityto = 'FRANKFURT'.

LOOP AT spfli_tab2 INTO tab_type.
WRITE: / tab_type-carrid,
tab_type-connid.
ENDLOOP.


14. 动态指定查询条件

DATA: cond(72) TYPE c,
itab LIKE TABLE OF cond,
city1(10) VALUE 'FRANKFURT',
city2(10) VALUE 'NEW YORK',
itab_spfli LIKE TABLE OF spfli WITH HEADER LINE.

CONCATENATE 'CITYFROM = ''' city1 '''' INTO cond.
APPEND cond TO itab.
CONCATENATE 'OR CITYFROM = ''' city2 '''' INTO cond.
APPEND cond TO itab.

SELECT *
FROM spfli
INTO TABLE itab_spfli
WHERE (itab).

LOOP AT itab_spfli.
WRITE: /
itab_spfli-cityfrom,
itab_spfli-cityto.
ENDLOOP.



15. 多表结合查询-select语句嵌套

DATA: wa_carrid TYPE spfli-carrid,
wa_connid TYPE spfli-connid,
wa_carrname TYPE scarr-carrname.

SELECT carrid connid
FROM spfli
INTO (wa_carrid, wa_connid)
WHERE cityfrom = 'NEW YORK'.
SELECT carrname
FROM scarr
INTO wa_carrname
WHERE carrid = wa_carrid.
WRITE / wa_carrname.
ENDSELECT. "内循环结束
ENDSELECT. "外循环结束

每当在表SPFLI中查询到一个符合条件的carrid值,系统就重新对SCARR进行一次
查询



16. 多表结合查询-for all entries

DATA: BEGIN OF wa_spfli,
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
END OF wa_spfli,
BEGIN OF wa_scarr,
carrid TYPE scarr-carrid,
carrname TYPE scarr-carrname,
END OF wa_scarr,
spfli_tab LIKE TABLE OF wa_spfli.

SELECT carrid connid
FROM spfli
INTO TABLE spfli_tab
WHERE cityfrom = 'NEWYORK'.

SELECT carrid carrname
FROM scarr
INTO wa_scarr FOR ALL ENTRIES IN spfli_tab "比对spfli_tab中的每个元组
WHERE carrid = spfli_tab-carrid.
WRITE / wa_scarr-carrname.
ENDSELECT.

先将SPFLI中符合条件数据选进一个内表,再…








17. 组合查询

REPORT Z_SELECT_JOIN.

data: wa_carrid type spfli-carrid,
wa_connid type spfli-connid,
wa_carrname type scarr-carrname.

select spfli~carrid scarr~carrname spfli~connid
from spfli inner join scarr on scarr~carrid = spfli~carrid
into (wa_carrid, wa_carrname, wa_connid)
where spfli~cityfrom = 'NEW YORK'.
write: / wa_carrid, wa_carrname, wa_connid.
endselect.


18. 分组总计查询

data: carrid type sflight-carrid,
minimum type p decimals 2,
maximum type p decimals 2.

write: / 'Carrier ID',
at 15 'Minimum Price',
at 30 'Maximum Price'.

select carrid MIN( price ) MAX( price )
into (carrid, minimum, maximum)
from sflight
group by carrid
having MIN( price ) > 500
order by carrid descending.
write: / carrid, minimum, maximum.
endselect.





一些问题:

ABAP编辑器的自动缩进问题
'''的问题
nest是嵌套的意思
package创建的问题






Package
Related objects in the ABAP Workbench are grouped together in a package. The assignment of an object to a package is entered in the object directory (TADIR). The package determines the transport layer that defines the transport attributes of an object.
The packages are entered in the table TDEVC. They can be maintained in the following transactions:

* Transaction SE80 -> Enter package -> Double-click the package

* Transaction SM30 - Table/view name V_TDEVC

The packages are themselves objects of the ABAP Workbench. They belong to their own packages.
In contrast to its predecessor, the development class, a package has the following additional characteristics:

* Packages can be nested.

* Packages can contain their 'visible development objects' (visible outside of the package) in package interfaces.

* Packages can have use access defined for other package interfaces.

Use
When an ABAP Workbench object is created, the system prompts you to assign it to a package. The package should describe the area that the object belongs to.
The representation of the object tree in the ABAP Workbench (transaction SE80) uses the package as a navigation aid. If there are more than 100 objects of a certain type (that is, ABAP programs), the object tree can no longer be clearly represented and it becomes increasingly difficult to use the ABAP Workbench. In this case, we recommend creating new packages with the same transport layer and distributing the objects to the new packages on the basis of the areas they belong to.
The following naming conventions for packages determine the packages' functions:

* Package begins with A-S or U-X:
These packages are for SAP standard objects. Customer objects cannot be created in them. Changes to objects of these packages are recorded by the Transport Organizer (Request management) and can be transported (see field transport layer.

* Package begins with Y or Z:
Customer objects can be created in these packages. Changes to objects in these packages are recorded by the Transport Organizer (Request management). The objects can be transported to other SAP Systems (see the field transport layer ).

* Package begins with T (private test package):
When you create a package of this type, you can specify whether you want changes to be recorded. If so, objects that are edited are recorded in local requests by the Transport Organizer. This package does not belong to a transport layer. Objects can only be transported to other SAP Systems if a transport request is created.

* Package begins with $ (local package):
Changes to objects are not recorded by the Transport Organizer. The package does not belong to a transport layer. The objects cannot be transported.

* Package begins with a namespace prefix:
If you have reserved a namespace, then you can create packages (and other objects) whose names begin with the namespace prefix.
(Example of a namespace prefix /COMPANY/, example of a corresponding package /COMPANY/DEVCLASS)
Changes to these packages are recorded by the Transport Organizer, and can be transported.










Transport Layer in ABAP Workbench
Definition
The Change and Transport System supports the distribution of development work on large projects across multiple SAP Systems.
The packages in each development system are grouped into one transport layer.
The transport layer determines whether objects are assigned to a local or transportable change request.
Use
Each of your SAP development systems is assigned a transport layer as its standard transport layer. If you use Extended Transport Control, you can assign different standard transport layers to certain clients.
You can define at the most one consolidation target for each SAP System and transport layer.
When you create a package, it is assigned the standard transport layer of the SAP System.
If you want to assign a different transport layer to a package, you require the administration authorization for the Change and Transport System.
The objects in a package automatically have the transport attributes defined for the corresponding transport layer.

* If a consolidation route originating in their SAP System is defined, then the objects are assigned to a transportable request, and transported into the consolidation target when it is released.

* If a consolidation route is not defined, the objects are assigned to a local request, and are not transported.

Customizing settings are not assigned to a package. They have the transport attributes of the standard transport layer of the system or client.
It is best to assign a package a standard transport layer for which a consolidation route originating in the development system is defined.
To display and maintain the transport layers and routes, use the Transport Management System (transaction STMS).
Only the system adminstrator can make changes.
Caution:
The tables TSYST, DEVL, TWSYS, TASYS are no longer productive as of Release 4.0A and cannot be maintained.

ABAP基础

一些需要注意的地方:
过程可以拥有自己的局部数据,事件块和对话模块中定义的数据为全局数据定义
函数名称和左括号间不能有空格,括号和参数间必须有空格
字段符号:ASSIGN (f) TO .”不是将f分配给,而是将f的内容作为新的数据对象名称分配给
指针指向的对象得是字段符号:ASSIGN dref1->* TO .
子程序:USING/CHANGING传址,USING VALUE传值,CHANGING VALUE传值后改变实参,其作用在于一旦自程序非正常中断,实参仍保持原值
两种类的构造方法:实例构造方法和对象构造方法
除属性、方法之外的第三种类成员——事件:声明、触发、事件处理、注册事件处理


一些简单的例子:
1. se38 activate compile, Pretty Printer, do n times, sy-index, write
data n type i value 5.
do n times.
write / sy-index left-justified.
enddo.
write: sy-uzeit,
sy-datum.


2. 简单内表操作
TYPES: BEGIN OF address,
street(20) TYPE c,
city(20) TYPE c,
END OF address.

DATA: BEGIN OF company,
cname(20) TYPE c,
addresses TYPE address,
END OF company.

DATA itab_company LIKE TABLE OF company WITH KEY cname.

company-cname = 'SAP Shanghai'.
company-addresses-street = 'Nanjing Road'.
company-addresses-city = 'Shanghai'.

APPEND company TO itab_company.

company-cname = 'SAP Beijing'.
company-addresses-street = 'Shuang Qing Road'.
company-addresses-city = 'Beijing'.

APPEND company TO itab_company.

READ TABLE itab_company WITH TABLE KEY cname = 'SAP Shanghai' INTO company."work area
WRITE / company.

READ TABLE itab_company WITH KEY addresses-city = 'Beijing' INTO company.
WRITE / company.


3. 静态分配字段符号
data: begin of address,
street(20) type c value 'Huatuo Road',
no(4) type c value '28',
zip(6) type c value '201203',
district(20) type c value 'Pudong',
city(20) type c value 'Shanghai',
end of address.

field-symbols: type c,
type c.

assign: address(30) to ,
address+30(40) to .

Write: / ,
/ .



4. 动态分配字段符号

field-symbols: .
data: str(20) type c value 'Output String',
name(20) type c value 'str'.

*Static assignment
assign name to .
write / .

*Dynamic assignment
assign (name) to .
write / .


5. 数据引用
Create data dref1 type t_struct
在运行期内动态创建一个数据对象,同时引用变量dref指向这一对象。该对象没有名称,只能通过数据引用变量进行寻址,在操作该数据对象之前,需要通过字段符号解除引用。

TYPES: BEGIN OF t_struct,

col1 TYPE i,

col2 TYPE i,

END OF t_struct.



DATA: dref1 TYPE REF TO DATA,

dref2 TYPE REF TO DATA.



FIELD-SYMBOLS: TYPE t_struct,

TYPE i.



CREATE DATA dref1 TYPE t_struct.

ASSIGN dref1->* TO .

-col1 = 1.

-col2 = 2.

dref2 = dref1.

ASSIGN dref2->* TO CASTING.

WRITE / .

GET REFERENCE OF -col2 INTO dref2.

ASSIGN dref2->* TO .

WRITE / .WRITE / .


与之基本对应的C

#include



struct t_struct{

int col1;

int col2;

};



void main(){

struct t_struct * dref1;

int * dref2;



struct t_struct aaa;

dref1 = & aaa;

dref1 -> col1 = 1;

dref1 -> col2 = 2;



dref2 = & aaa.col1;

printf ( "%d\n", * dref2 );

dref2 = & aaa.col2;

printf ( "%d\n", * dref2 );

}




6. 子程序
DATA: int1 TYPE i VALUE 1,
int2 TYPE i VALUE 1.

WRITE: / 'Before Calling Subroutine :',
int1, int2.

PERFORM self_add USING int1 int2.

WRITE: / 'After Calling Subroutine : ',
int1, int2.

FORM self_add USING p1 TYPE i
value(p2) TYPE i.
p1 = p1 + 1.
p2 = p2 + 1.
WRITE: / 'Inside Subroutine : ',
p1, p2.
ENDFORM.


7. 功能组功能模块

se38 create function group, creat function module
LTOP是功能组内部的全局数据定义区
LUXX包含具体的功能模块代码
LFXX用于容纳功能组内部的子程序
Import input_1,input_2
Export output
Source code 输入:output = input_1 + input_2. 运行测试
在希望调用功能模块的程序编辑状态中单击Pattern功能
data: int1 type i value 3,
int2 type i value 4,
sum type i.

CALL FUNCTION 'Z_TTT_ADD'
EXPORTING
input1 = int1
input2 = int2
IMPORTING
OUTPUT = sum.
if sy-subrc = 0.
write sum.
endif.


8. 类定义

class vehicle definition.
public section.
class-data class_name(10) type c value 'Vehicle'.
methods: accelerate,
show_speed.
protected section.
data speed type i.
endclass.

class vehicle implementation.
method accelerate.
speed = speed + 1.
endmethod.
method show_speed.
write: / 'Speed:', speed.
endmethod.
endclass.



9. 定义全局类
se80 (se24)
Instantiation实例类型,
Final不能被继承
Persistent 稳定性检查
Only modeled该类只有图形化模型,没有具体实现部分
设置attributes,method 保存
activate, test


10. 函数方法
class circle definition
public section.
methods get_area importing value(i_radius) type i
returning value(r_size) type f.
private section.
constants pi type f value '3.14159265'.
endclass.

class circle implementation.
method get_area.
r_size = i_radius ** 2 * pi.
endmethod.
endclass.

parameters radius type i.
data: o_circle type ref to circle,
area type f.

create object o_circle.
call method o_circle->get_area
exporting i_radius = radius
receiving r_size = area.
write: / area.
area = o_circle->get_area( radius ).
write: / area.


疑惑:
对象的命名限制
ABAP编辑器与word编辑器不兼容

ABAP编辑器的缩进



Linux

Andrew Tanenbaum created MINIX

Every time there was a choice between code simplicity and efficiency/features Tanenbaum chose simplicity (to make it easy to teach with MINIX), which meant that this system lacked many of features people wanted. Linux goes in the opposite direction.

Because this is the reverse of the way a normal copyright works (it gives rights instead of limiting them), it has been termed a copyleft.Two key words for Linux are "Have Fun!"

one of several replacements for the vi editor is named elvis

In fact, it made so many popular changes that one version of the system is called the Berkeley Software Distribution (BSD)of the UNIX system (or just Berkeley UNIX). The other major version is UNIX System V (SVR4), which descended from versions developed and maintained by AT&T and UNIX System Laboratories.

Although it mimics UNIX in many ways, the Linux operating system departs from UNIX in several significant ways: The Linux kernel is implemented independently of both BSD and System V, the continuing development of Linux is taking place through the combined efforts of many capable individuals throughout the world, and Linux puts the power of UNIX within easy reach of business and personal computer users. Using the Internet, today's skilled programmers submit additions and improvements to the operating system to Linus Torvalds, GNU, or one of the other authors of Linux.

IBM (www.ibm.com/linux) is a major Linux supporter. Linux conforms increasingly more closely to POSIX standards, and some distributions and parts of others meet this standard.

Linux often supports a peripheral or interface card before any company does. Unfortunately some types of peripherals—particularly proprietary graphics cards—lag in their support because the manufacturers do not release specifications or source code for drivers in a timely manner, if at all.

the Compaq's (née Digital Equipment Corporation) Alpha-based machines

Emulators
Linux supports programs, called emulators, that run code intended for other operating systems. By using emulators you can run some DOS, Windows, and Macintosh programs under Linux. Wine (www.winehq.com) is an open-source implementation of the Windows API on top of X and UNIX/Linux; QEMU (fabrice.bellard.free.fr/qemu) is a CPU-only emulator that executes x86 Linux binaries on non-x86 Linux systems.

More than 95 percent of the Linux operating system is written in the C programming language, and C is portable because it is written in a higher-level, machine-independent language. (The C compiler is written in C.)

POSIX (Portable Operating System Interface for computer Environments) standard

Programs written in assembly language work on only one machine or, at best, one family of machines

high-level language

the American National Standards Institute (ANSI)

the GNU Project's C compiler (named gcc)

The GNU Project's C compiler and its C++ compiler (g++) are integral parts of the Linux operating system.

If you are running the X Window System (page 15), you can run different programs in different windows on the same screen and watch all of them.

link of Linux = shortcut of Windows

The Shell: Command Interpreter And Programming Language

In a textual environment, the shell—the command interpreter—acts as an interface between you and the operating system. When you enter a command on the screen, the shell interprets the command and calls the program you want. A number of shells are available for Linux including these two common ones:

The Bourne Again Shell (bash), an enhanced version of the Bourne Shell, one of the original UNIX shells

The TC Shell (tcsh), an enhanced version of the C Shell, developed as part of BSD UNIX

Shell commands can be arranged in a file for later execution. Linux calls these files shell scripts; DOS and Windows call them batch files