0

I have a task to write a JCL job invoking ICETOOL/DFSORT to generate a report. The report takes a VSAM KSDS as input and generates a list of bank branches.

Each record in the BRANCHES KSDS is of the form

• 4-byte binary unsigned integer representing a 6-digit decimal branch sortcode (e.g. 420101)

• 1-byte EBCDIC flag: ◦ EBCDIC 'A' means the branch is owned by ZeusBank and all its accounts are held in the ACCOUNTS KSDS

◦ EBCDIC 'B' means the branch is not owned by ZeusBank so we do not hold its account information in the ACCOUNTS KSDS

• 32-byte EBCDIC character branch name (e.g. “ZEUSBANK FOOFORD BAR STREET” or “OTHERBANK QUUXHAM BAZ ROAD”), blank padded on the right.

The report should look like this

enter image description here

I'm pretty new to JCL so please forgive if the question is simple. Thanks.

Tri Nguyen
  • 1,688
  • 3
  • 18
  • 46
  • Is the report sorted on 1 byte flag? Do you want header only once or should it be repeated after a set of records? – user6542823 Nov 17 '17 at 06:24
  • This link should help you, if you need more help then let me know: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.iceg200/ice2cg_Headers.htm – user6542823 Nov 17 '17 at 06:33
  • Yeah I want it's once only, I have come across the headers thing but there's an error which stop me from doing anything [https://ibb.co/kNy0tR]. How can I fix this? – Tri Nguyen Nov 17 '17 at 10:40
  • What is the error? I Can't see the link. – user6542823 Nov 17 '17 at 14:29
  • My report looks like this [https://pastebin.com/gQS9ZEBr]. And I got the error, `O. MESSAGE 1 HASP105 EXPECTED CONTINUATION NOT RECEIVED 1 IEFC621I EXPECTED CONTINUATION NOT RECEIVED 2 IEFC662I INVALID LABEL 2 IEFC605I UNIDENTIFIED OPERATION FIELD`. How can I fix it? Thanks. – Tri Nguyen Nov 17 '17 at 15:24
  • You don't need to use ICETOOL. Use Pgm=Sort and then use OUTFIL HEADER2. The error you are getting is because of '-' at the end of each statement. I'll post answer shortly. – user6542823 Nov 17 '17 at 15:52
  • Thanks a lot. Anyway, I tried to review the VSAM file provided but I can't. It says `VSAM processing unavail`. Is there any way I can view the file? – Tri Nguyen Nov 17 '17 at 16:00
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/159249/discussion-between-tri-nguyen-and-user6542823). – Tri Nguyen Nov 17 '17 at 16:32

1 Answers1

0

You can try this:

//STEPSORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=DATASETNAME
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(5,1,CH,A)
OUTFIL HEADER2=(1:C'LIST OF WHATEVER BANK',4/,
1:C'SORTCODE',10:C'FLAG',15:C'BRANCH',/,
1:C'--------',10:C'----',15:C'------'),
BUILD=(1:1,4,BI,TO=ZD,LENGTH=6,10:5,1,15:6,32)
/*
user6542823
  • 1,396
  • 2
  • 14
  • 24
  • Thanks man. However it says `DEFINE - INSUFFICIENT AUTHORITY STMT NO. MESSAGE - 5 IGD308I DATA SET ALLOCATION REQUEST FAILED - RACF FUNCTION: RACDEF FOR DATA SET: SHECICS.ZEUSBANK.BRANCHES WITH RETURN CODE 08 REASON CODE 00` – Tri Nguyen Nov 17 '17 at 20:41
  • May I ask some questions in chat anyway? – Tri Nguyen Nov 17 '17 at 20:43
  • When I add `DISP=SHR`, I got the error `IEFC621I EXPECTED CONTINUATION NOT RECEIVED`. Do you know how to fix it? – Tri Nguyen Nov 17 '17 at 20:47
  • I am not free at the moment, will be back after 2 hours. I'll need to see your Job. – user6542823 Nov 17 '17 at 21:01
  • Done it, it was my fault leaving a space after a comma. Thanks. How can I sort the `sortcode` number (which is the first column). – Tri Nguyen Nov 17 '17 at 22:37
  • I change to `SORT FIELD(1,6,ZD,A)` because it's binary format but I still got this [https://ibb.co/iBHfTR] result – Tri Nguyen Nov 17 '17 at 22:48
  • Figured it out anyway. Can you explain these parameters `(1:1,4,BI,TO=ZD,LENGTH=6,10:5,1,15:6,32)` – Tri Nguyen Nov 17 '17 at 22:57
  • `1,4,BI,TO=ZD` means that your input starting from 1 to 4 bytes is Binary and you want to convert it to Zoned Decimal (viewable format) and then `LENGTH=6` tells that you want that ZD to be of length 6. Then `10:5,1` says that from column 10 in output, you want what is present in input at column 5 and 1 byte long. Then `15:6,32` says that, at column 15 of output, you want what is present in input at column 6 with 32 bytes. Glad you got what you wanted. – user6542823 Nov 17 '17 at 23:54
  • How can I remove the leading zeros of a column? – Tri Nguyen Nov 18 '17 at 00:03
  • IF you want to remove leading zeroes from your sortcode then use `1,4,BI,TO=ZD,EDIT=(IIIIIT)`. So, it becomes `(1:1,4,BI,TO=ZD,EDIT=(IIIIIT),10:5,1,15:6,32)` – user6542823 Nov 18 '17 at 00:06
  • Here's my code for another job `BUILD=(1:1,4,BI,TO=ZD,LENGTH=6,10:5,4,BI,TO=ZD,LENGTH=8, 20:9,4,BI,TO=ZD,EDIT=(IIIIIT),30:13,32) ` and I got syntax error. The format for the third column is 4-byte signed integer. What did I do wrong? – Tri Nguyen Nov 18 '17 at 00:11
  • If it is another requirement, post another question with representative input data and required output. I'll have a look. – user6542823 Nov 18 '17 at 00:13