Can CLIST access PDS member and GDG file?

Ask/Clarify the questions on TSO, CLIST & REXX

Moderators: Veera, Moderator Group

Post Reply
mjhjh
Member
Posts: 5
Joined: Fri Aug 13, 2010 10:14 pm

Can CLIST access PDS member and GDG file?

Post by mjhjh » Fri Aug 13, 2010 10:43 pm

I need to check a string in a GDG file, for example, to check 'ABCDEFG' in file : AAA.BBB.CCC.DDD(0).

IF YES, append this string 'ABCDEFG' to the bottom of a PDS member:

ABD.EFG.HIG(NAMES).

IF BOTH FILES ARE PSD FILES, there is no problem, while I changed to GDG and PDS member, it didn't work.

My Clist program can not allocate a gdg file, and also can not append to a member.It overided the member, when i allocated the file to SHR and OLD. MOD didn't work to a member file.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Fri Aug 13, 2010 11:12 pm

not sure, but probably the 13th and the 17th line of code are giving you the problem.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

mjhjh
Member
Posts: 5
Joined: Fri Aug 13, 2010 10:14 pm

Post by mjhjh » Sat Aug 14, 2010 1:24 am

Does anybody have experience to deal with PDS member and GDG files?

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Sat Aug 14, 2010 2:22 am

Does anybody have experience to deal with PDS member and GDG files?
plenty of us do, but we also have had it with idiots that say my clist does not work
and then don't bother to show us the clist.

If I have to guess, then so do you.

couple of points:

can't refer to gdg as AAA.BBB.CCC.DDD(0).

how are you going about 'apending' to the bottom of a pds member?

always allocate PDS member as SHR.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

mjhjh
Member
Posts: 5
Joined: Fri Aug 13, 2010 10:14 pm

Post by mjhjh » Sun Aug 15, 2010 9:48 am

when i use a flat file like 'AAA.BBB.CCC.NAMELOG' and 'ABC.DEF.GHI.NAMES' , it works ok, but when i chenge to GDG file and PDS member,errors happen. it can not find file abc.efg.names(0), and can not add to the member. If i change to SHR, it will clear the old records and write the new name to the member.

here is the code:
(this code extracted from a long program manually, may contain some other errors, but the most important thing i need help is how to read a GDG file and how to append records to a member file)

PROC 0 DSN1('AAA.BBB.CCC.NAMELOG')
ALLOCATE FILE(OFILE) DA('&DSN1') MOD
OPENFILE OFILE OUTPUT

SET EOF = OFF
SET RCODE = 0
SET CNAME = 'JOHN'
SET DNS2 = 'ABC.DEF.GHI.NAMES'

ALLOCATE FILE(NEXTNAME) DA(&DNS2) SHR
OPENFILE NEXTNAME INPUT

DO WHILE &EOF = OFF OR &RCODE ¬= 0
GETFILE NEXTNAME

IF &EOF=ON THEN DO
SET RCODE = 1
END

IF &STR(&SUBSTR(1:4,&NEXTNAME) = &CNAME THEN DO
CLOSFILE NEXTNAME
FREE F(NEXTNAME)
SET RCODE = 0
GOTO WRITELOG
END

END


WRITELOG: SET OFILE = &CNAME
PUTFILE OFILE
EXIT

mjhjh
Member
Posts: 5
Joined: Fri Aug 13, 2010 10:14 pm

Post by mjhjh » Sun Aug 15, 2010 10:12 am

dbzTHEdinosauer wrote:
Does anybody have experience to deal with PDS member and GDG files?
plenty of us do, but we also have had it with idiots that say my clist does not work
and then don't bother to show us the clist.

If I have to guess, then so do you.

couple of points:

can't refer to gdg as AAA.BBB.CCC.DDD(0).

how are you going about 'apending' to the bottom of a pds member?

always allocate PDS member as SHR.

I have no experience on CList, this is my first program. Could you please let me know how do you read a gdg file like AAA.BBB.CCC.DDD(0), and how do you add a record to a existing pds member like ABD.EFG.HIG(NAMES)? Thanks!

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Sun Aug 15, 2010 3:03 pm

1. use rexx, not clist. clist is a good (albeit very old) language for sys-programmers,
but for data manipulation, REXX is better.

2. look for OUTTRAP and LISTDSI. this will list the gdg names with GnnnVnn, which is the syntax that you have to use.

3. to 'append' lines to a pds member, either
  • invoke an EDIT session with an IMACRO which can INSERT_AFTER your line
  • use EXECIO to read the member into a stem, then add your line to the stem, then use EXECIO to write the member
suggest you look (google) for websites concerning REXX. There are many and each has a routine here or there that will accomplish what you wish.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others