IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How can i retrieve the batch name for each detail record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Thu Nov 20, 2008 5:16 pm
Reply with quote

Hi can any one help with these

i have a file where the records are as follows

1
5 this is a batch header wer i hav ( batch name)
6 this is detail record
7 same detail of above record continued
8batch trailer
5another new batch header with a new name
6another detailed record
7
6another detailed record
7
6
7
6
7
8
9

How can i retrieve the batch name for each detail record
the problem is the each detail records are sorted on some other basis

i have used this file and sorted and processed it further to write a report
without much changes to the program can any one suggest me a
easy way to get the coressponding batch name for all detail records.
using sort or any other means
i cant write a new program to get that batch name and
then sort it and another program to process and write a new report.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Thu Nov 20, 2008 5:44 pm
Reply with quote

Hi edwin,

Quote:
the problem is the each detail records are sorted on some other basis


Could you pls elaborate on this...

Quote:
1
5 this is a batch header wer i hav ( batch name)
6 this is detail record
7 same detail of above record continued
8batch trailer
5another new batch header with a new name
6another detailed record
7
6another detailed record
7
6


what i assumed from you post is.. The i/p file is of the format u mentioned with record type number. From the record type no. u can distinguish it from the other records. so while processing if find a match on type 5 get the header to a group variable(structure of header) and find the batch name.

we can help you if we understand ur question correctly...

regards,
Kratos
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Thu Nov 20, 2008 9:29 pm
Reply with quote

I sort the 6 & 7 record type based on another field
Ie
622
799
622
799

627
799
627
799

And I will process these two files to write two categories in a report
Now I need corresponding batch name
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 21, 2008 3:13 am
Reply with quote

Hello Edwin and welcome to the forum,

To help us help you, you need to post more realistic sample input, the output you currently get from that input, and what additional output you want - either in another file or in the current output.

Are you using an internal sort currently?

Once you better describe the requirement, someone may be able to help.
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Fri Nov 21, 2008 10:50 am
Reply with quote

Hi all,
before going deep into the requirement first help up with these
the input and output files are as follows
Need to do insert the batch name (ex Edwin) in each of its detail records
in place of invalid account no .usign sort or iceman or any other means but not a program as i further sort this file and process to write a report

I/P file

101 03110020921124181910008110738H094101INNNNDINIDD, N.A.
5200edwin 2390526440PPDDEPOSIT
6210311002095010000005764996A0000050004 SBM DDA
799R04020083030505426 03110020INVALID ACCOUNT NUMBER
6210311002095010000005765089B0000052504 SBM DDA
799R04020083030505427 03110020INVALID ACCOUNT NUMBER
820000000400062200400000000000000000001025081132518466
5200MEshak 2390526440PPDDEPOSIT
6260311002095010000005765495D0000062504 SBM DDA
799R04020083030505429 03110020INVALID ACCOUNT NUMBER
820000000200031100200000000625040000000000001132518466



Output :

101 03110020921124181910008110738H094101INNNNDINIDD, N.A.
5200edwin 2390526440PPDDEPOSIT
6210311002095010000005764996A0000050004 SBM DDA
799R04020083030505426 03110020edwin
6210311002095010000005765089B0000052504 SBM DDA
799R04020083030505427 03110020edwin
820000000400062200400000000000000000001025081132518466
5200MEshak 2390526440PPDDEPOSIT
6260311002095010000005765495D0000062504 SBM DDA
799R04020083030505429 03110020 MEshak
820000000200031100200000000625040000000000001132518466
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Nov 21, 2008 11:03 am
Reply with quote

For such requirement, I would suggest to use SORT in jcl instead of processing from COBOL program (if possible)

Quote:
i have used this file and sorted and processed it further to ...



Please post actual input before sort too along with final desired output.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Nov 21, 2008 11:12 am
Reply with quote

Quote:
but not a program as i further sort this file

And how that output will look like?
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Fri Nov 21, 2008 11:29 am
Reply with quote

@ Sambhaji

Am using a Sort in Jcl only
further input file is same as below

101 03110020921124181910008110738H094101INNNNDINIDD, N.A.
5200edwin 2390526440PPDDEPOSIT
6210311002095010000005764996A0000050004 SBM DDA
799R04020083030505426 03110020INVALID ACCOUNT NUMBER
6210311002095010000005765089B0000052504 SBM DDA
799R04020083030505427 03110020INVALID ACCOUNT NUMBER
820000000400062200400000000000000000001025081132518466
5200MEshak 2390526440PPDDEPOSIT
6260311002095010000005765495D0000062504 SBM DDA
799R04020083030505429 03110020INVALID ACCOUNT NUMBER
820000000200031100200000000625040000000000001132518466

i Just want to inser each of these batch names in each of the detail records particulary inside tat batch

I do SORT these files further to process to write a report based on another
field where i do need to retrive the corresponding batch name.
The problem is i have sorted it.
either tel me a way to insert the name in each batch using some sort techniques so it wil be easy to retrive.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Nov 21, 2008 1:11 pm
Reply with quote

Quote:
@ Sambhaji

Am using a Sort in Jcl only

I got confused because it is posted in COBOL forum.
Try this one
Code:

//S1   EXEC  PGM=ICETOOL                                         
//TOOLMSG   DD  SYSOUT=*                                         
//DFSMSG    DD  SYSOUT=*                                         
//INP1  DD *                                                     
101 03110020921124181910008110738H094101INNNNDINIDD, N.A.         
5200EDWIN 2390526440PPDDEPOSIT                                   
6210311002095010000005764996A0000050004 SBM DDA                   
799R04020083030505426 03110020INVALID ACCOUNT NUMBER             
6210311002095010000005765089B0000052504 SBM DDA                   
799R04020083030505427 03110020INVALID ACCOUNT NUMBER             
820000000400062200400000000000000000001025081132518466           
5200MESHAK 2390526440PPDDEPOSIT                                   
6260311002095010000005765495D0000062504 SBM DDA                   
799R04020083030505429 03110020INVALID ACCOUNT NUMBER             
820000000200031100200000000625040000000000001132518466   
/*                                                       
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD DSN=EX.DEX006.OFILE,DISP=(MOD,CATLG,DELETE)     
//TOOLIN DD *                                             
   COPY FROM(INP1) TO(T1) USING(CTL1)                     
   COPY FROM(INP1) TO(OUT1) USING(CTL2)                   
   SPLICE FROM(T1) TO(OUT1) ON(91,8,ZD) -                 
   WITHALL WITH(1,80) KEEPBASE USING(CTL3)               
/*                                                       
//CTL1CNTL DD *                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(91:SEQNUM,8,ZD)),     
  IFTHEN=(WHEN=(1,4,CH,EQ,C'5200'),                       
  OVERLAY=(81:5,6,91:SEQNUM,8,ZD)),                       
  IFTHEN=(WHEN=NONE,                                     
  OVERLAY=(99:SEQNUM,8,ZD,                               
  91:91,8,ZD,SUB,99,8,ZD,M11,LENGTH=8))                         
/*                                                             
//CTL2CNTL DD *                                                 
  OPTION COPY,STOPAFT=1                                         
/*                                                             
//CTL3CNTL DD *                                                 
  OUTFIL IFTHEN=(WHEN=(31,22,CH,EQ,C'INVALID ACCOUNT NUMBER'), 
                 BUILD=(1,30,31:81,6,37:16X,53:53,28)),         
         IFTHEN=(WHEN=NONE,BUILD=(1,80)),                       
         FNAMES=OUT1                                           
/*                                                             
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Fri Nov 21, 2008 2:32 pm
Reply with quote

E RECORD TYPE IS F - DATA STARTS IN POSITION 1
1 END OF FIELD BEYOND MAXIMUM RECORD LENGTH

this error occurs while i try running it
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Nov 21, 2008 2:54 pm
Reply with quote

Above is tested solution.
Post your JCL here.
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Fri Nov 21, 2008 3:00 pm
Reply with quote

//SSY2335D JOB (TEST),'REJ REPT',NOTIFY=&SYSUID,CLASS=F,
// MSGLEVEL=(1,1),MSGCLASS=X,TIME=NOLIMIT
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INP1 DD DSN=SSY2335.USER.REJECT.FILE2,DISP=SHR
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD DSN=SSY2335.NEW.REJECT,DISP=(MOD,CATLG,DELETE)
//TOOLIN DD *
COPY FROM(INP1) TO(T1) USING(CTL1)
COPY FROM(INP1) TO(OUT1) USING(CTL2)
SPLICE FROM(T1) TO(OUT1) ON(95,8,ZD) -
WITHALL WITH(1,94) KEEPBASE USING(CTL3)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(95:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,2,CH,EQ,C'52'),
OVERLAY=(103:5,16,95:SEQNUM,8,ZD)),
IFTHEN=(WHEN=NONE,
OVERLAY=(119:SEQNUM,8,ZD,
95:95,8,ZD,SUB,119,8,ZD,M11,LENGTH=8))
/*
//CTL2CNTL DD *
OPTION COPY,STOPAFT=1
/*
//CTL3CNTL DD *
OUTFIL IFTHEN=(WHEN=(1,3,CH,EQ,C'799'),
BUILD=(1,35,36:103,16,51:28X,79:79,15)),
IFTHEN=(WHEN=NONE,BUILD=(1,94)),
FNAMES=OUT1
/*




this is the jcl which i ran
the input file total size is 94 so i have changed it accordingly
instead of "invalid account no" we insert it whenever a 799 record is found

Can u pls help us further on this
and thanks for ur help.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Nov 21, 2008 3:24 pm
Reply with quote

Code:
BUILD=(1,35,36:103,16,51:28X,79:79,15)),

Check this line.
it should be
Code:
BUILD=(1,35,36:103,16,52:27X,79:79,15)),
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Fri Nov 21, 2008 3:40 pm
Reply with quote

still getting the same error icon_sad.gif

error code is posted below

ICE146I 0 END OF STATEMENTS FROM CTL3CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL3,SORTIN=T1,
TOUT=OUT1,DYNALLOC,SZERO,EQUALS,NOVLSHRT,LOCALE=NONE,
HECK
SORT FIELDS=(95,8,ZD,A)
MODS E35=(ICE35DU,12288)
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE027A 1 END OF FIELD BEYOND MAXIMUM RECORD LENGTH
ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E4-K90007 E7-K24705
ICE052I 3 END OF DFSORT
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Nov 21, 2008 4:07 pm
Reply with quote

Post TOOLMSG MESSAGES.
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Fri Nov 21, 2008 4:10 pm
Reply with quote

0 MODE IN EFFECT: STOP

COPY FROM(INP1) TO(T1) USING(CTL1)
0 DFSORT CALL 0001 FOR COPY FROM INP1 TO T1 USING CTL1CNTL
0 OPERATION RETURN CODE: 00

COPY FROM(INP1) TO(OUT1) USING(CTL2)
0 DFSORT CALL 0002 FOR COPY FROM INP1 TO OUT1 USING CTL2CNTL
0 OPERATION RETURN CODE: 00
SPLICE FROM(T1) TO(OUT1) ON(95,8,ZD) -
WITHALL WITH(1,94) KEEPBASE USING(CTL3)
0 DFSORT CALL 0003 FOR SORT FROM T1 TO OUT1 USING CTL3CNTL
0 OPERATION RETURN CODE: 16


0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE: 16
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Nov 21, 2008 9:59 pm
Reply with quote

edwin_infy,

Sambhaji assumed your input file has RECFM=FB and LRECL=80, but didn't bother to mention that. Is that the actual RECFM and LRECL of your input file? If not, what is the RECFM and LRECL of your input file

If your input file does have RECFM=FB and LRECL=80, show the complete set of //DFSMSG messages you received.

Also, what is the length of the batch name? Does 'INVALID ACCOUNT NUMBER' always appear in '7' record? Does it always start in the same position (what position?) or can its starting position vary?
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Sat Nov 22, 2008 7:17 pm
Reply with quote

hi

Any idea what the error is
I cud not post the tool MSG as am not in mainframe
Will post it on Monday

Thks
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Sat Nov 22, 2008 9:12 pm
Reply with quote

LRECL is 94 and format is fb
Should Tat be VB
Size of batch name is 16
INVALID ACCOUNT NO starts at position 36
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Nov 22, 2008 9:23 pm
Reply with quote

Quote:
LRECL is 94 and format is fb


Then Sambhaji's assumption of LRECL=80 was wrong.

Quote:
Should That be VB


No.

Please answer this question I asked in my previous post.

Quote:

Does 'INVALID ACCOUNT NUMBER' always appear in '7' record? Does it always start in the same position (what position?) or can its starting position vary?
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Sat Nov 22, 2008 9:38 pm
Reply with quote

LRECL is 94 and format is fb
Should Tat be VB
Size of batch name is 16
INVALID ACCOUNT NO starts at position 36
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Sat Nov 22, 2008 9:42 pm
Reply with quote

ya it always appears at 7th record starts at position 36
It won't vary
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Nov 22, 2008 10:10 pm
Reply with quote

Edwin,

The easiest way to do this would be with the WHEN=GROUP function of DFSORT, available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008), like this:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/94)
//SORTOUT DD DSN=...  output file (FB/94)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=94,
   IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'5'),
    PUSH=(95:5,16)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'7'),OVERLAY=(36:95,16,6X))
/*


However, I can see from the messages you posted that you don't have this PTF. Ask your System Programmer to install it.

You can do what you want without WHEN=GROUP in a slightly more complicated way (though not as complicated as the "solution" Sambhaji proposed), like this:

Code:

//S1    EXEC  PGM=ICETOOL                                           
//TOOLMSG   DD  SYSOUT=*                                           
//DFSMSG    DD  SYSOUT=*                                           
//IN DD DSN=...  input file (FB/94)
//OUT DD DSN=...  output file (FB/94)                               
//TOOLIN  DD    *                                                   
SPLICE FROM(IN) TO(OUT) ON(95,8,ZD) KEEPBASE WITHALL -             
  WITH(1,94) USING(CTL1)               
/*                           
//CTL1CNTL DD *                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(95:SEQNUM,8,ZD)),               
        IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),                             
                OVERLAY=(95:SEQNUM,8,ZD,111:5,16)),                 
        IFTHEN=(WHEN=NONE,                                         
                OVERLAY=(103:SEQNUM,8,ZD,                           
                         95:95,8,ZD,SUB,103,8,ZD,TO=ZD,LENGTH=8))   
  OUTFIL FNAMES=OUT,                                               
   IFOUTLEN=94,                                                     
   IFTHEN=(WHEN=(1,1,CH,EQ,C'7'),OVERLAY=(36:111,16,6X))           
/*
Back to top
View user's profile Send private message
edwin_infy

New User


Joined: 01 Jul 2008
Posts: 32
Location: chennai

PostPosted: Mon Nov 24, 2008 10:09 am
Reply with quote

@ Frank

It worked well thanks for ur help

Can this same functionality be achieved by a simple SORT
Just want to know

@ all
thanks for all ur responses
keep rocking

regards
edwin
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Nov 24, 2008 9:58 pm
Reply with quote

Quote:
Can this same functionality be achieved by a simple SORT
Just want to know


I don't know what you mean by a "simple SORT". If you mean by a DFSORT step, rather than an ICETOOL step, then the WHEN=GROUP step I showed above meets that criteria.

If you're thinking that there's a difference between using PGM=ICEMAN and PGM=SORT, there isn't. They are equivalent.

If that doesn't answer your question, then explain more clearly what you mean by a "simple SORT" (and why it matters).
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts How to get a stack trace on a looping... ABENDS & Debugging 5
Search our Forums:

Back to Top