How to write JCL to send an email but the content(Data) should be picked from another PDS/member. If anyone can let me know the JCL for what I need will be helpful.**
Here is an old example but it sounds like what you are looking for. It uses IEBGENER to send an e-mail. (I didn't write the content so complain to IBM if you don't like it.)
This is from Knowledge Center
//BATSMTP JOB (userid,nn),MSGCLASS=B,PRTY=12,MSGLEVEL=(2,1)
//*
//* Store message in a PDS
//*
//PUTMSG EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD *
HELO YOURMVS
MAIL FROM:<CAROL#YOURMVS>
RCPT TO:<msgs#rsch.our.edu>
RCPT TO:<alice#ai.our.edu>
DATA
Date: Thur, 26 Mar 92 21:48:57 EST
From: Carol <CAROL#YOURMVS>
To: <msgs#rsch.your.edu>
Cc: <alice#ai.your.edu> Subject: update
Mike: Cindy stubbed her toe. Bobby went to
baseball camp. Marsha made the cheerleading team.
Jan got glasses. Peter has an identity crisis.
Greg made dates with 3 girls and couldn't
remember their names.
.
QUIT
/*
//SYSUT2 DD DSN=MYPDS.OF.MESSAGES(MSGID1),DISP=SHR
//*
//SYSPRINT DD SYSOUT=A
//*
//* Send Message from placed in PDS in prior step
//*
//SENDMSG EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD DSN=MYPDS.OF.MESSAGES(MSGID1),DISP=SHR
//*
//SYSUT2 DD SYSOUT=(B,smtp)
//* | v
//* v SMTP address space name for external writer
//* SYSOUT class
//SYSPRINT DD SYSOUT=A
Concatenate your PDS member with your other stuff in SYSUT1 e.g.
//SYSUT1 DD *
your stuff here
// DD DSM=your.pds(member),DISP=SHR
`You may need other stuff after your member - just concatenate more DD *.
Remember that your PDS data must be LRECL=80
Concatenation works fine if all source data has the same DCB. If not, use SORT to create a temporary VB file with LRECL = your longest LRECL + 4. E.g., if you need to merge 80-byte PDS data with 133-byte reports, use SORT to copy everything to a VB file with LRECL=137 and send that to the sysout.
If anyone is still reading, I'd like to find out how to set up a BCC: recipient. Apparently, only TO: and CC: are supported.
Sample JCL for building the VB file:
000007 //BUILD PROC
000008 //SORT EXEC PGM=SORT
000009 //SORTOUT DD DISP=(MOD,PASS),DSN=&&EMAIL,UNIT=SYSDA,
000010 // SPACE=(CYL,(1,1)),DCB=(RECFM=VB,LRECL=430,BLKSIZE=27998)
000011 //*
000012 //SYSIN DD *
000013 OPTION COPY
000014 OUTFIL FNAMES=SORTOUT,FTOV
000015 //SORTWK01 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000016 //SORTWK02 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000017 //SORTWK03 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000018 //SORTWK04 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000019 //SORTWK05 DD SPACE=(CYL,(5,5),RLSE),UNIT=SYSDA
000020 //SYSPRINT DD SYSOUT=*
000021 //SORTMSG DD SYSOUT=*
000022 //SYSDBOUT DD SYSOUT=*
000023 //SYSUDUMP DD SYSOUT=*
000024 //SYSOUT DD SYSOUT=*
000025 //*
000026 // PEND
000027 //*
000028 //HEADER EXEC BUILD --------------------------------------------
000029 //SORT.SORTOUT DD DISP=(,PASS)
000030 //SORT.SORTIN DD *
000031 HELO MVSOSA.CAPITALONE.COM
000032 MAIL FROM:<{from address}>
000033 RCPT TO:<{to address}>
000034 DATA
000035 FROM: <{from address}>
000036 TO:<{to address>
000037 SUBJECT: {subject}
000038 MIME-Version: 1.0
000039 Content-type: multipart/mixed; boundary="=_boundary"
000040
000041 These comments don't show up in the email.
000042
000043 Note: After each boundary, one or more records describes the
000044 content that follows. After the last "Content-..." record
000045 in each section, be sure to have a blank line.
000046
000047
000049
000050 See also https://www.ibm.com/support/pages/
000051 outbound-email-attachments-using-smtp-or-cssmtp-zos
000052
000053 --=_boundary
000054 Content-Type: text/plain;
000055
000056 Good day.
000057 Please find attached the reports you wanted.
000058
000059 Regards -- Me
000060
000061 --=_boundary
000062 Content-Type: application;
000063 Content-Disposition: attachment; filename={report name}.txt
000064 Content-Transfer-Encoding: 8bit;
000065
000066 /*
000067 //STATRPT EXEC BUILD
000068 //SORT.SORTIN DD DISP=SHR,DSN={file name with report}
000069 //*
000070 //*
000071 //*-------------------------------------------------------------*
000072 //EMAILSTP EXEC PGM=IEBGENER
000073 //SYSPRINT DD SYSOUT=*
000074 //SYSIN DD DUMMY
000075 //SYSUT2 DD SYSOUT=(B,SMTP)
000076 //SYSUT1 DD DISP=(OLD,PASS),DSN=&&EMAIL
000077 //*
000078 //*==============================================================
000079 //*
Related
I am trying to familiarize myself with COBOL. I try to start the following program:
identification division.
program-id. Bestand.
date-written. 08.05.2020
environment division.
input-output section.
file-control.
select bestand-datei-ein assign to
"C:\Users\Michael\Desktop\Microfocus\Programme\aus.txt".
select bestand-datei-aus assign to
"C:\Users\Michael\Desktop\Microfocus\Programme\aus.txt".
data division.
file section.
fd bestand-datei-ein label records are omitted.
01 bestand-satz-ein.
05 e-teile-nr PIC X(6).
05 e-bestand-menge PIC 9(5).
05 e-eingang-menge PIC 9(4).
05 e-stueck-preis PIC 999V99.
fd bestand-datei-aus label records are omitted.
01 bestand-satz-aus.
05 a-teile-nr PIC X(6).
05 filler PIC X(4).
05 a-bestand-menge PIC 9(5).
05 filler PIC X(3).
05 a-eingang-menge PIC 9(4).
05 filler PIC X(3).
05 a-stueck-preis PIC 999.99.
05 filler PIC X(3).
05 a-bestand-menge-neu PIC 9(5).
05 filler PIC X(3).
05 a-kosten PIC 9(6).99.
01 a PIC X.
working-storage section.
01 bestand-datei-ein-ende PIC X.
procedure division.
a000-haupt-steuerung-routine.
open input bestand-datei-ein
output bestand-datei-aus.
move 'N' to bestand-datei-ein-ende.
read bestand-datei-ein
at end move 'J' to bestand-datei-ein-ende.
perform b010-listen-bestandsdaten
until bestand-datei-ein-ende = 'J'.
close bestand-datei-aus
bestand-datei-ein.
accept a.
stop run.
b010-listen-bestandsdaten.
move spaces to bestand-satz-aus.
move e-teile-nr to a-teile-nr.
move e-bestand-menge to a-bestand-menge.
move e-eingang-menge to a-eingang-menge.
move e-stueck-preis to a-stueck-preis.
add e-bestand-menge, e-eingang-menge
giving a-bestand-menge-neu.
multiply a-bestand-menge-neu by e-stueck-preis
giving a-kosten.
read bestand-datei-ein
at end
move 'J' to bestand-datei-ein-ende.
I always get the error message "File not found: C: \ Users \ Michael \ Desktop \ Microfocus \ Program \ aus.txt" when I start the program and the should be opened.
I work with Micro Focus Visual Cobol for Visual Studio
Any idea ?
From comment:
The problem has now been solved. The file names were not displayed correctly in the code (cut and paste errors). It should read "ein.txt" and aus.txt. The problem was that the file names in the file system were set so that the extension is not displayed. I named the input file "ein.txt" and basically created a file named "ein.txt.txt". Therefore the file was not found.
I'm debugging dump files, while I have access to the symbol files.
I'm using a script, which combines the results of following windbg commands:
x /2 *!* // which types are present in the symbol files?
!heap -h 0 // which memory address ranges are used in the dump?
(At least, that's how I understand it. In case I'm wrong don't hesitate to correct me)
The result of the script (called heap_stat.py, found under this list of Windbg extensions) is a list of memory addresses, followed by their type. By taking statistics of those I can derive if there is a memory leak.
In top of this, using the WinDbg command dt CStringArray m_nSize of the mentioned memory address (in the specific case of a CStringArray, of course), I can see the total amount of entries of the used CStringArray objects, and see if there are CStringArray objects with lots of entries.
However there is a drawback to this system:
When I find such a CStringArray object with a lot of entries, I'm stuck there because out of all the CStringArray objects in my application, I have no idea which one I'm dealing with.
One thing which might help is the name of the local variable the memory address is about, but there's the catch: I don't know if this information is present and in case yes, can I find it in the symbol file or in the dump, and (obviously) which command do I need to run in order to get this information (I didn't find a flag that makes dt <flag> <memory address> return the local variable name, occupied by <memory address>)?
Can anybody help me?
For clarification purposes, this is how the result of my script currently looks like:
0x0065a4d0 mfc110u!CStringArray Size:[1]
0x0065a4e4 mfc110u!CStringArray Size:[0]
0x0065a4f8 mfc110u!CStringArray Size:[295926]
0x0065a520 mfc110u!CStringArray Size:[0]
As you can see, I can see the memory address where my variable is stored, I can see the type (retrieved from the symbols files), and I can see the amount of entries (retrieved from the dt Windbg command), but I'd like to have an output like the following:
0x0065a4d0 mfc110u!CStringArray Size:[1] var1
0x0065a4e4 mfc110u!CStringArray Size:[0] var2
0x0065a4f8 mfc110u!CStringArray Size:[295926] var3
0x0065a520 mfc110u!CStringArray Size:[0] var3
or:
0x0065a4d0 mfc110u!CStringArray Size:[1] obj1.prop1
0x0065a4e4 mfc110u!CStringArray Size:[0] obj2.prop1
0x0065a4f8 mfc110u!CStringArray Size:[295926] obj1.prop2
0x0065a520 mfc110u!CStringArray Size:[0] obj1.prop2
Such an output would indicate me that I need to verify what is happening to var3 or obj1.prop2 in the source code.
I wrote the following MFC application (partial source):
CStringArray stringarray;
void* anotherarray = new CStringArray();
void CLocalVariableNameApp::AnotherMethod(void* a)
{
CStringArray* temp = static_cast<CStringArray*>(a);
temp->Add(L"Something else");
}
CLocalVariableNameApp::CLocalVariableNameApp()
{
stringarray.Add(L"Something");
AnotherMethod(anotherarray);
CStringArray* holycow = static_cast<CStringArray*>(anotherarray);
holycow->Add(L"Yet something else");
DebugBreak();
}
As you can see, the second CStringArray has multiple names: anotherarray, a, temp and holycow.
Observation 1: there will not be an easy 1:1 mapping on memory addresses and variable names.
Local variable names are available from the PDB files:
0:000> k
# ChildEBP RetAddr
00 0022fa40 00fa2a30 KERNELBASE!DebugBreak+0x2
01 0022fb3c 00f97958 LocalVariableName!CLocalVariableNameApp::CLocalVariableNameApp+0x90 [c:\...\localvariablename.cpp # 38]
02 0022fc10 014b628a LocalVariableName!`dynamic initializer for 'theApp''+0x28 [c:\...\localvariablename.cpp # 43]
03 0022fc18 014b5e8c LocalVariableName!_initterm+0x1a [f:\...\crt0dat.c # 955]
04 0022fc2c 014a9263 LocalVariableName!_cinit+0x6c [f:\...\crt0dat.c # 308]
05 0022fc78 014a947d LocalVariableName!__tmainCRTStartup+0xf3 [f:\...\crt0.c # 237]
06 0022fc80 7558336a LocalVariableName!wWinMainCRTStartup+0xd [f:\...\crt0.c # 165]
07 0022fc8c 771198f2 kernel32!BaseThreadInitThunk+0xe
08 0022fccc 771198c5 ntdll!__RtlUserThreadStart+0x70
09 0022fce4 00000000 ntdll!_RtlUserThreadStart+0x1b
0:000> .frame 1
01 0022fb3c 00f97958 LocalVariableName!CLocalVariableNameApp::CLocalVariableNameApp+0x90 [c:\...\localvariablename.cpp # 38]
0:000> dv
this = 0x01637118
holycow = 0x00445820
Note that the names a and temp are not visible.
Observation 2: variable names will be limited to their scope. If you want to remember all variable names, you would need to track all functions.
Above was a debug build. The release build is different:
0:000> k
# ChildEBP RetAddr
00 005efe04 002a1c18 KERNELBASE!DebugBreak+0x2
01 005efe20 002a1095 LocalVariableName!CLocalVariableNameApp::CLocalVariableNameApp+0x88 [c:\...\localvariablename.cpp # 39]
02 005efe24 003c0289 LocalVariableName!`dynamic initializer for 'theApp''+0x5 [c:\...\localvariablename.cpp # 43]
03 005efe38 003c01ea LocalVariableName!_initterm+0x29 [f:\...\crt0dat.c # 954]
04 005efe48 003bd280 LocalVariableName!_cinit+0x5a [f:\...\crt0dat.c # 321]
05 005efe88 7558336a LocalVariableName!__tmainCRTStartup+0xde [f:\...\crt0.c # 237]
06 005efe94 771198f2 kernel32!BaseThreadInitThunk+0xe
07 005efed4 771198c5 ntdll!__RtlUserThreadStart+0x70
08 005efeec 00000000 ntdll!_RtlUserThreadStart+0x1b
0:000> .frame 1
01 005efe20 002a1095 LocalVariableName!CLocalVariableNameApp::CLocalVariableNameApp+0x88 [c:\...\localvariablename.cpp # 39]
0:000> dv
this = 0x0043f420
Note that holycow is missing.
Observation 3: in release builds, variables might not be needed (optimized) and therefore not present.
Overall conclusion: it's not possible to map memory addresses to variable names.
I have a ACR122U-A9, I want to card emulate with it.
I ask who has done this point? Can you give me some suggestions?
Now I have also other problems, when I put the white smartcard on this NFC reader, LED blinks only once. But when I put the phone on it, the LED always blinks until phone out.
The ACR122U contains a PN532 NFC controller chip. The PN532 supports host card emulation through its TgInitAsTarget command (see the PN532 user manual). In order to pass commands to the PN532, you would connect to the ACR122U just as if it was a normal smartcard reader (e.g. using PC/SC). You can then send pack PN532 commands into reader-APDUs of the form
> FF000000 <Lc> <Command>
and get responses in the form
< <Response> 9000
So for getting the ACR122 into card emulation mode, you would do about the following:
ReadRegister:
> FF000000 08 D406 6305 630D 6338
< D507 xx yy zz 9000
Update register values:
xx = xx | 0x004; // CIU_TxAuto |= InitialRFOn
yy = yy & 0x0EF; // CIU_ManualRCV &= ~ParityDisable
zz = zz & 0x0F7; // CIU_Status2 &= ~MFCrypto1On
WriteRegister:
> FF000000 11 D408 6302 80 6303 80 6305 xx 630D yy 6338 zz
< D509 9000
SetParameters:
> FF000000 03 D412 30
< D513 9000
TgInitAsTarget
> FF000000 27 D48C 05 0400 123456 20 000000000000000000000000000000000000 00000000000000000000 00 00
< D58D xx ... 9000
Where xx should be equal to 0x08.
Communicate using a sequence of TgGetData and TgSetData commands:
> FF000000 02 D486
< D587 xx <C-APDU> 9000
Where xx is the status code (should be 0x00 for success) and C-APDU is the command sent from the reader.
> FF000000 yy D48E <R-APDU>
< D587 xx 9000
Where yy is 2 + the length of the R-APDU (response) and xx is the status code (should be 0x00 for success).
Basically ACR122U is not made to emulate the card while there is still very little information from manufacturer saying that it can be used to emulate an NFC card. If this is possible, it would be not that straight forward. I suggest you try Android Host Card Emulation (HCE on Android 4.4).
For part 2: I tried with my phone (Xperia Z) when I turned on the NFC chip and place the phone over the card reader, nothing happened from both sides. Maybe you are using card emulation feature of the phone.
Is there a parameter for sort programme to exclude (ignore) the first line of a file from sorting in jcl.
Thanks,
If your Sort level is up-to-date, you can use DATASORT. Borrowed from an answer by Frank Yaeger, via google.
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
FIRST
AAAA
CCCC
DDDD
FFFF
GGGG
//OUT DD SYSOUT=*
//TOOLIN DD *
DATASORT FROM(IN) TO(OUT) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,4,CH,A)
/*
You can try the following:
//SYSIN DD *
SORT FIELDS=...
SKIPREC=1
/*
You may have to do a sort copy and in a subsequent JCL step do the sort.
Try using the ICETOOL SUBSET operator. Here is a really simple example:
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD * -- Unsorted input data...
FIRST LINE
5
6
7
1
4
/*
//TOOLIN DD * -- ICETOOL commands
SUBSET FROM(IN1) TO(OUT1) REMOVE INPUT HEADER
/*
//OUT1 DD SYSOUT=* -- Sorted output goes here
Upon completion OUT1 contains:
1
4
5
6
7
which are the data from IN1, sorted, missing the first input line.
The DFSORT/ICETOOL manual can be found here and the
ICETOOL SUBSET operator is
documented here
edit
Based on your comment to Gilbert, I suggest using a second job step to
IDCAMS REPRO (copy) the first record from the original input file and then concatenate it to the ICETOOL output. The JCL is relatively straight forward.
I am learning mainframe programming (TSO, JCL, COBOL...) and I came across a problem I can't seem to solve, yet.
I have a file with records that contain 3 fields and I want to use 'outfil' to include only certain records in the output file.
My JCL is the following:
000001 //C8112J1 JOB (12345678),C8112,MSGCLASS=H,
000002 // MSGLEVEL=(1,1),NOTIFY=C8112
(...)
000007 //DSNDEL EXEC PGM=IDCAMS
000008 //SYSPRINT DD SYSOUT=*
000009 //SYSIN DD *
000010 DELETE C8112.DATA.FX.SORT
000011 SET MAXCC = 0
000012 /*
(...)
000014 //* --------- S O R T -----------
000020 //MYSORT EXEC PGM=SORT,COND=(0,NE)
000021 //SORTIN DD DSN=C8112.DATA.FX,DISP=SHR
000022 //SORTOUT DD DSN=C8112.DATA.FX.SORT,
000023 // SPACE=(TRK,(100,100),RLSE),
000024 // DISP=(NEW,CATLG,DELETE),
000025 // DCB=(LRECL=61,RECFM=FB)
000026 //SYSIN DD *
000027 SORT FIELDS=COPY
000028 //* SORT FIELDS=(1,18,CH,A) OU SORT=COPY
000029 OUTFIL INCLUDE=(1,18,CH,EQ,C'ANDRADE,LUISA')
...
000031 //* OUTREC=(39,41,1,18,19,38)
000032 END
000033 //SYSOUT DD SYSOUT=*
000034 /*
and the output file:
000001 LUIS,CARLOS AV.PAULO VI RMR
000002 DIAS,PATTY RUA PEDRO CALMON LX
000003 ANDRADE,LUISA AV. DA LIBERDADE LX (1)
000004 SILVA,TONI PALACIO VALMOR LX
000005 ANDRADE,LUISA AV. DA BOAVISTA POT (2)
000006 CISCO,MANUEL QUINTA DA AVELEDA TC
Wasn't I supposed to get only the records (1) and (2)?! By the way, I also tried the 'outrec' to change the bytes organization but it didn't work too.
Can anyone give me a hint on what I am doing wrong?
You can use a single * as a comment delimiter in DFSORT rather than //* - which, as has already been pointed out terminates the SYSIN just as if you'd coded /. (You indeed have a / later on, I notice.)
Try the following:
000020 //MYSORT EXEC PGM=SORT,COND=(0,NE)
000021 //SORTIN DD DSN=C8112.DATA.FX,DISP=SHR
000022 //SORTOUT DD DSN=C8112.DATA.FX.SORT,
000023 // SPACE=(TRK,(100,100),RLSE),
000024 // DISP=(NEW,CATLG,DELETE),
000025 // DCB=(LRECL=61,RECFM=FB)
000026 //SYSIN DD *
000027 SORT FIELDS=COPY
000029 OUTFIL INCLUDE=(1,18,CH,EQ,C'ANDRADE,LUISA')
...
000032 END
000031 /*
000033 //SYSOUT DD SYSOUT=*
000034 //*
SORT SYSIN does not allow for "comments". Those lines you thought might have been comments really are't. They terminate the SYSIN DD statements. Basically I just got rid of:
//* SORT FIELDS=(1,18,CH,A) OU SORT=COPY
and
//* OUTREC=(39,41,1,18,19,38)
then it all works fine. Remember, a JCL comment is not a SORT comment! The stuff after a DD * are data, not JCL source statements so JCL type commenting conventions do not work here. The DD * is typically terminated by a line starting with: /*.